anchorme.js
anchorme.js copied to clipboard
anchorme.validate.url crash app with unencoded uri.
Hi,
I've an angular app that use anchrome lib for url validation at some point. With some urls, the app crash !
Test it with this url => https://pages.getpostman.com/rs/067-UMD-991/images/ban-api-builder (1).jpg
I had to add an encodeURI in order to use the validation without issue.
The lib should encode uri or at least do not make the app crash.
Best regards 👋🏻
We hit this in our app. Some URLs cause the browser tab to hit 100% CPU and never complete validation, e.g.
https://en.wikipedia.org/wiki/Robert_Cranston_(Scottish_politician)
Some URLs do validate, just very slowly, e.g.
https://en.wikipedia.org/wiki/Robert_Cranston(abcdefg) takes a minute or so.
Some shorter URLs take less time, e.g.
https://en.wikipedia.org/wiki/Robert_Cranston(a)
(This is in Chrome).
Is the recommendation that we ought to be URL encoding before calling anchorme.validate.url?
Codepen with some timings: https://codepen.io/mattrussell-glean/pen/jOmjBmJ