Can we make redirect middleware not to throw when url parameter passed to it has non-ASCII characters?
#206
jakovljevic-mladen
started this conversation in
Proposals For Qwik
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What is it about?
The
redirectmiddleware doesn't work when theurlparameter passed to it containes non-ASCII characters and I would like it to simply work out of the box.What's the motivation for this proposal?
Problems you are trying to solve:
redirectmiddleware should work with any valid URL passed to it.Goals you are trying to achieve:
Any other context or information you want to share:
For example, if I do something like this:
redirect(302, '/vic/2345/djed-priča-priču-unucima');, please notice two charactersčpassed toredirectin the second parameter. When called like this,redirectthrows an error that says something likeCannot convert argument to a ByteString because the character at index 8 has a value of 269 which is greater than 255., most probably meaning that it can't convert non-ASCII characters before sending them in response.Proposed Solution / Feature
What do you propose?
I propose to modify
redirectmiddleware so it would simply accept any kind of string and user wouldn't have to do anything. The proposal is to wrapfixedURLfrom this line withencodeURI. In that case,encodeURIwill encode URLs properly and send them to the client without error being thrown.Code examples
This is the proposed solution:
Links / References
No response
Beta Was this translation helpful? Give feedback.
All reactions