Query decoding broken in 4.90
grahamburgsma opened this issue · 3 comments
grahamburgsma commented
Describe the bug
Decoding query parameters that are url encoded fails, starting with version 4.90. Still broken in latest version 4.91.1. It works as expected up to 4.89.3.
To Reproduce
...path?value=1%25%20milk
let value = try req.query.get(String.self, at: "value")
Throws an error Value at path 'value' was not of type 'String'. Data found at 'value' was not String.
.
Expected behavior
Does not throw an error. value
is 1% milk
.
weissi commented
The problem appears to be a double decoding of the query string. For example if you pass v=M%26M
, then the value of request.query.get(at: "v")
is M
instead of M&M
.
Similarly ?v=M%2526M
yields M&M
instead of M%26M
.