sindresorhus / normalize-url

Normalize a URL
MIT License
840 stars 122 forks source link

This lib crashes on mobile Safari or Chrome in iOS #142

Closed Madsim closed 3 years ago

Madsim commented 3 years ago

I don't have the possibility to get an error message, but found this lib to crash our app on mobile. It's enough to import it, to cause the problem.

Reported it here as well: https://github.com/sindresorhus/get-urls/issues/74

Update:

The Problem is caused by this line in v.5.3.1 (used by get-urls): urlObj.pathname = urlObj.pathname.replace(/(?<!\b(?:[a-z][a-z\d+\-.]{1,50}:))\/{2,}/g, '/');

I don't know why get-urls is using such an old version, but maybe updating the dep will fix it.

edenhermelin commented 3 years ago

@sindresorhus we are also facing this issue on Safari (desktop), since they don't support negative lookbehind (?<=). is there a chance to fix this? currently it requires us to freeze the dependency to an older version in our project

freben commented 3 years ago

@sindresorhus Another ping from us with Backstage as well. We (transitively) use this library in a browser env and just want to check with you, is it an intentional choice to keep the lookahead/lookbehind in place and abandoning Safari support? Or is it more a matter of not having had time to address it. I do see that the README of this package states that one should stay on the 4.x line if one needs browser support, but would you be willing to accept a change to the implementation to backtrack on that particular problem?