[Solved]-How can I receive percent encoded slashes with Django on App Engine?

4๐Ÿ‘

โœ…

os.environ['PATH_INFO'] is decoded, so you lose that information. Probably os.environ['REQUEST_URI'] is available, and if it is available it is not decoded. Django only reads PATH_INFO. You could probably do something like:

request_uri = environ['REQUEST_URI']
request_uri = re.sub(r'%2f', '****', request_uri, re.I)
environ['PATH_INFO'] = urllib.unquote(request_uri)

Then all cases of %2f are replaced with **** (or whatever you want to use).

๐Ÿ‘คIan Bicking

Leave a comment