Catch malformed URI Components

Fix for error thrown when a value contains non-valid / malformed URI Component
Example: test=%c5%a1%e8ZM%80%82H
will throw "URI malformed"
This update will leave the value as-is when an error is thrown
This commit is contained in:
Jeroen Diderik 2021-11-24 11:13:27 +01:00 committed by Stephan Hoyer
parent 1eec62eb3e
commit fae15d3489
2 changed files with 14 additions and 2 deletions

View file

@ -20,6 +20,10 @@ o.spec("parseQueryString", function() {
var data = parseQueryString("?%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23=%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23")
o(data).deepEquals({";:@&=+$,/?%#": ";:@&=+$,/?%#"})
})
o("handles wrongly escaped values", function() {
var data = parseQueryString("?test=%c5%a1%e8ZM%80%82H")
o(data).deepEquals({test: "%c5%a1%e8ZM%80%82H"})
})
o("handles escaped slashes followed by a number", function () {
var data = parseQueryString("?hello=%2Fen%2F1")
o(data.hello).equals("/en/1")