deps: encodeurl@~2.0.0 (#5569)

This commit is contained in:
Blake Embrey
2024-05-04 13:53:09 -07:00
committed by GitHub
parent d97d79ed9a
commit bf91946bd4
4 changed files with 11 additions and 24 deletions

View File

@@ -55,7 +55,6 @@ module.exports = res
*/
var charsetRegExp = /;\s*charset\s*=/;
var schemaAndHostRegExp = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\/\/[^\\\/\?]+/;
/**
* Set status `code`.
@@ -914,14 +913,7 @@ res.location = function location(url) {
loc = String(url);
}
var m = schemaAndHostRegExp.exec(loc);
var pos = m ? m[0].length + 1 : 0;
// Only encode after host to avoid invalid encoding which can introduce
// vulnerabilities (e.g. `\\` to `%5C`).
loc = loc.slice(0, pos) + encodeUrl(loc.slice(pos));
return this.set('Location', loc);
return this.set('Location', encodeUrl(loc));
};
/**