aboutsummaryrefslogtreecommitdiffstats
path: root/server.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2020-03-08 13:40:32 -0700
committerJames Taylor <user234683@users.noreply.github.com>2020-03-08 13:40:32 -0700
commitfa112592fa306f5d75ce94d840969835f2d02302 (patch)
tree23ff7777251c1c1db9a339b4dff6f17c23b8837b /server.py
parentaf334a8ac711cf8dd2c36cd770a51506979ae528 (diff)
downloadyt-local-fa112592fa306f5d75ce94d840969835f2d02302.tar.lz
yt-local-fa112592fa306f5d75ce94d840969835f2d02302.tar.xz
yt-local-fa112592fa306f5d75ce94d840969835f2d02302.zip
Correct malformed query strings: change ? to & so flask
parses it correctly. Otherwise, parameters starting with ? will be included in the video id, which messes up the comments since the extraneous data is passed into the the ctoken.
Diffstat (limited to 'server.py')
-rw-r--r--server.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/server.py b/server.py
index ac30156..5a68928 100644
--- a/server.py
+++ b/server.py
@@ -74,6 +74,9 @@ def error_code(code, start_response):
def site_dispatch(env, start_response):
client_address = env['REMOTE_ADDR']
try:
+ # correct malformed query string with ? separators instead of &
+ env['QUERY_STRING'] = env['QUERY_STRING'].replace('?', '&')
+
method = env['REQUEST_METHOD']
path = env['PATH_INFO']