1
0
Fork 0
forked from svrjs/svrjs

Fixed bug in the URL parser (URLs with "@" got erroneously "sanitized" to "/")

This commit is contained in:
Dorian Niemiec 2024-05-21 17:08:06 +02:00
parent 5781233ff7
commit 6933e3e9ed

2
svr.js
View file

@ -1359,7 +1359,7 @@ function parseURL(uri, prepend) {
var hasSlashes = (uri.indexOf("/") != -1);
// Parse the URL using regular expression
var parsedURI = uri.match(/^(?:([^:]+:)(\/\/)?)?(?:([^@]+)@)?([^:\/?#\*]+|\[[^\*]\/]\])?(?::([0-9]+))?(\*|\/[^?#]*)?(\?[^#]*)?(#[\S\s]*)?/);
var parsedURI = uri.match(/^(?:([^:]+:)(\/\/)?)?(?:([^@:\/?#\*]+)@)?([^:\/?#\*]+|\[[^\*]\/]\])?(?::([0-9]+))?(\*|\/[^?#]*)?(\?[^#]*)?(#[\S\s]*)?/);
// Match 1: protocol
// Match 2: slashes after protocol
// Match 3: authentication credentials