anchorme.js icon indicating copy to clipboard operation
anchorme.js copied to clipboard

anchorme.validate.url crash app with unencoded uri.

Open nricca opened this issue 5 years ago • 2 comments

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 👋🏻

nricca avatar Jun 02 '20 11:06 nricca

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?

mattrussell-sonocent avatar Aug 18 '21 11:08 mattrussell-sonocent

Codepen with some timings: https://codepen.io/mattrussell-glean/pen/jOmjBmJ

mdr avatar Aug 18 '21 11:08 mdr