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
-
What is it about?
The
redirect
middleware doesn't work when theurl
parameter 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:
redirect
middleware 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 toredirect
in the second parameter. When called like this,redirect
throws 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
redirect
middleware so it would simply accept any kind of string and user wouldn't have to do anything. The proposal is to wrapfixedURL
from this line withencodeURI
. In that case,encodeURI
will 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