-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow any protocol in the duplicate slashes normalization #115
Allow any protocol in the duplicate slashes normalization #115
Conversation
Prior to this, duplicate slashes would be removed unless preceeded by "http" or "https" protocols. This was too strict. The regex was updated to allow for any 2+ character alphanumeric protocol. Went with requiring at least 2 characters since every scheme listed here (https://en.wikipedia.org/wiki/List_of_URI_schemes) is at least 2 characters.
Removes unnecessary group
I think it should have a length limit too. |
@sindresorhus Length limit set to 30. The longest one I found on the above referenced Wiki was 27, so 30 seemed reasonable. However, given the completely arbitrary nature of such a limit, I'm thinking it should either be much larger or configurable. What do you think? |
* Adds two new options, for min/max length of what the dupe slash removal regex recognizes as a protocol. * Updates tests to exercise the new options * Updates readme to document the new options
@sindresorhus Arbitrary bounds felt wrong so I went ahead and made this configurable. |
I'm not interested in having this configurable. The point is to prevent possible abuse. We can make it 50. |
Fixes #114
Prior to this, duplicate slashes would be removed unless preceded by "http" or "https" protocols. This was too strict.
The regex was updated to allow for any 2+ character alphanumeric protocol. Went with requiring at least 2 characters since every scheme listed here (https://en.wikipedia.org/wiki/List_of_URI_schemes) is at least 2 characters.