diff options
author | Jesús <heckyel@hyperbola.info> | 2020-12-19 22:24:32 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-12-19 22:24:32 -0500 |
commit | 574cb2dae8534a8abba5710217e4f6c8655ff854 (patch) | |
tree | 3df94ec66dfdff4cf23453ae4d2213f902bd7918 /server.py | |
parent | 8823b54bc1324d42731c02ebcd461108e76105c5 (diff) | |
download | yt-local-574cb2dae8534a8abba5710217e4f6c8655ff854.tar.lz yt-local-574cb2dae8534a8abba5710217e4f6c8655ff854.tar.xz yt-local-574cb2dae8534a8abba5710217e4f6c8655ff854.zip |
Fix env["PATH_INFO"] for UWSGI, prevents bad url formatting
e.g:
ValueError: Invalid or unsupported url: https:/www.youtube.com/watch
Diffstat (limited to 'server.py')
-rw-r--r-- | server.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -195,6 +195,12 @@ def site_dispatch(env, start_response): # correct malformed query string with ? separators instead of & env['QUERY_STRING'] = env['QUERY_STRING'].replace('?', '&') + # Fix PATH_INFO for UWSGI + if 'REQUEST_URI' in env: + env['PATH_INFO'] = urllib.parse.unquote( + env['REQUEST_URI'].split('?')[0] + ) + method = env['REQUEST_METHOD'] path = env['PATH_INFO'] |