Forums

+ sign in url not accepting

I have a flask app running. I pass base64 encoded hash codes in the URL to authenticate. For ex:

/hash/1244sdfdsdfsfdf=1212c/

The above works all fine.

But if the hash code contains a '+' sign like:

/hash/124421dfdfdf+sdx/

then I am getting a 404 error, that means the URL is not being mapped to any of the routes in my app. How to overcome this?

A "+" in a URL has a special meaning -- it's a way of escaping a space character. Flask is probably converting it to a space before doing the matching. The best bet is probably to use a different encoding to base64 for your hashes -- perhaps hex?