From 083371f20ff8463262ab55babe337387ce085c12 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 1 Sep 2022 22:46:57 +0200 Subject: [PATCH] keep_blank_values --- files/classes/comment.py | 2 +- files/helpers/const.py | 1 - files/helpers/sanitize.py | 2 +- files/routes/posts.py | 6 +++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 6cb92acb4..05fe80d1e 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -347,7 +347,7 @@ class Comment(Base): url = i.group(1) p = urlparse(url).query - p = parse_qs(p) + p = parse_qs(p, keep_blank_values=True) if 'sort' not in p: p['sort'] = ['controversial'] diff --git a/files/helpers/const.py b/files/helpers/const.py index bd2dc8b4c..40462d5a4 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -338,7 +338,6 @@ else: # localhost or testing environment implied FEATURES['PRONOUNS'] = True FEATURES['HATS'] = True FEATURES['HOUSES'] = True - FEATURES['REPOST_DETECTION'] = False if CARP_ID: GIFT_NOTIF_ID = CARP_ID elif AEVANN_ID: GIFT_NOTIF_ID = AEVANN_ID diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index eb7c60641..21a7c4961 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -309,7 +309,7 @@ def sanitize(sanitized, edit=False, limit_pings=0, showmore=True): if i.group(0) in captured: continue captured.append(i.group(0)) - params = parse_qs(urlparse(i.group(2)).query) + params = parse_qs(urlparse(i.group(2)).query, keep_blank_values=True) t = params.get('t', params.get('start', [0]))[0] if isinstance(t, str): t = t.replace('s','') diff --git a/files/routes/posts.py b/files/routes/posts.py index 42d123461..479db486a 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -656,7 +656,7 @@ def is_repost(): query=None, fragment=parsed_url.fragment) else: - qd = parse_qs(parsed_url.query) + qd = parse_qs(parsed_url.query, keep_blank_values=True) filtered = {k: val for k, val in qd.items() if not k.startswith('utm_') and not k.startswith('ref_')} new_url = ParseResult(scheme="https", @@ -765,7 +765,7 @@ def submit_post(v, sub=None): query=None, fragment=parsed_url.fragment) else: - qd = parse_qs(parsed_url.query) + qd = parse_qs(parsed_url.query, keep_blank_values=True) filtered = {k: val for k, val in qd.items() if not k.startswith('utm_') and not k.startswith('ref_')} new_url = ParseResult(scheme="https", @@ -806,7 +806,7 @@ def submit_post(v, sub=None): if yt_id_regex.fullmatch(yt_id): req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={yt_id}&key={YOUTUBE_KEY}&part=contentDetails", timeout=5).json() if req.get('items'): - params = parse_qs(urlparse(url).query) + params = parse_qs(urlparse(url).query, keep_blank_values=True) t = params.get('t', params.get('start', [0]))[0] if isinstance(t, str): t = t.replace('s','')