keep_blank_values

master
Aevann1 2022-09-01 22:46:57 +02:00
parent 523bfd93c5
commit 083371f20f
4 changed files with 5 additions and 6 deletions

View File

@ -347,7 +347,7 @@ class Comment(Base):
url = i.group(1) url = i.group(1)
p = urlparse(url).query p = urlparse(url).query
p = parse_qs(p) p = parse_qs(p, keep_blank_values=True)
if 'sort' not in p: p['sort'] = ['controversial'] if 'sort' not in p: p['sort'] = ['controversial']

View File

@ -338,7 +338,6 @@ else: # localhost or testing environment implied
FEATURES['PRONOUNS'] = True FEATURES['PRONOUNS'] = True
FEATURES['HATS'] = True FEATURES['HATS'] = True
FEATURES['HOUSES'] = True FEATURES['HOUSES'] = True
FEATURES['REPOST_DETECTION'] = False
if CARP_ID: GIFT_NOTIF_ID = CARP_ID if CARP_ID: GIFT_NOTIF_ID = CARP_ID
elif AEVANN_ID: GIFT_NOTIF_ID = AEVANN_ID elif AEVANN_ID: GIFT_NOTIF_ID = AEVANN_ID

View File

@ -309,7 +309,7 @@ def sanitize(sanitized, edit=False, limit_pings=0, showmore=True):
if i.group(0) in captured: continue if i.group(0) in captured: continue
captured.append(i.group(0)) 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] t = params.get('t', params.get('start', [0]))[0]
if isinstance(t, str): t = t.replace('s','') if isinstance(t, str): t = t.replace('s','')

View File

@ -656,7 +656,7 @@ def is_repost():
query=None, query=None,
fragment=parsed_url.fragment) fragment=parsed_url.fragment)
else: 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_')} filtered = {k: val for k, val in qd.items() if not k.startswith('utm_') and not k.startswith('ref_')}
new_url = ParseResult(scheme="https", new_url = ParseResult(scheme="https",
@ -765,7 +765,7 @@ def submit_post(v, sub=None):
query=None, query=None,
fragment=parsed_url.fragment) fragment=parsed_url.fragment)
else: 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_')} filtered = {k: val for k, val in qd.items() if not k.startswith('utm_') and not k.startswith('ref_')}
new_url = ParseResult(scheme="https", new_url = ParseResult(scheme="https",
@ -806,7 +806,7 @@ def submit_post(v, sub=None):
if yt_id_regex.fullmatch(yt_id): 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() 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'): 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] t = params.get('t', params.get('start', [0]))[0]
if isinstance(t, str): t = t.replace('s','') if isinstance(t, str): t = t.replace('s','')