-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URL Decoding on server is not correct #18
Comments
Apparently github's issue markdown won't preserve multiple spaces. The above examples are for |
I would have thought that any client bears responsibility of encoding correctly - if it's encoded differently as I'm not sure why we should expect I was wondering what the consensus was on handling this, as I presume it would come up often, and this stack overflow post summarises that they have distinct purposes depending on where they are placed |
This is the problem, they are two different but both valid encodings of the same user input.
I partly agree because the url encoding is an implementation detail and from the user's point of view it makes no difference (we could just as easily base64 encode it or use any other encoding instead). However we do need the same user input to produce the same image regardless of the client, and currently that's not the case. |
Actually even javascript's |
Surely we can just advise a url encoding scheme for all clients in an API doc, which should resolve this issue from a dev perspective on new clients using our API, including our own client |
It gets worse...We really do need to actually fix it on the server side, otherwise we can't start with a slash. We can still leave the original endpoint path working for legacy purposes (and it's a little more elegant for handwriting in img tags 😄) |
In order to handle any user input correctly (see #4), it has to be URL encoded before placing in the URL.
For example, in javascript,
encodeURIComponent("asdf ")
returnsasdf%20%20
.This generates the following face.
Unfortunately, that's not the only way spaces (and probably other things) can be URL encoded.
For example, an HTML form request or
System.Web.HttpUtility.UrlEncode
will encode spaces as+
rather than%20
:System.Web.HttpUtility.UrlEncode("asdf ")
returnsasdf++
.This generates the following face, noticably different to above.
Furthermore, it returns the same face for
asdf%2B%2B
asasdf++
;%2B
is the url encoding of+
.I expect the problem is to do with how flask automatically decodes parts of the path to pass as the
hash
parametercheckface/src/server/checkface.py
Lines 131 to 132 in 594152d
Expected Behaviour:
The generated face for the url encodings as
asdf%20%20
andasdf++
should both be the same (should both be the first image), corresponding to the user input ofasdf
.The generated face for the url encoding as
asdf%2B%2B
should be different (it should be the second image), and correspond to the user input ofasdf++
.The text was updated successfully, but these errors were encountered: