sfd
This commit is contained in:
parent
71e0a1ad58
commit
e301149a36
1 changed files with 17 additions and 9 deletions
|
@ -757,16 +757,24 @@ def submit_post(v):
|
||||||
parsed_url = urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
|
|
||||||
domain = parsed_url.netloc
|
domain = parsed_url.netloc
|
||||||
|
if domain == 'old.reddit.com':
|
||||||
|
new_url = ParseResult(scheme="https",
|
||||||
|
netloc=parsed_url.netloc,
|
||||||
|
path=parsed_url.path,
|
||||||
|
params=parsed_url.params,
|
||||||
|
query=None,
|
||||||
|
fragment=parsed_url.fragment)
|
||||||
|
else:
|
||||||
|
qd = parse_qs(parsed_url.query)
|
||||||
|
filtered = dict((k, val) for k, val in qd.items() if not k.startswith('utm_') and not k.startswith('ref_'))
|
||||||
|
|
||||||
qd = parse_qs(parsed_url.query)
|
new_url = ParseResult(scheme="https",
|
||||||
filtered = dict((k, val) for k, val in qd.items() if not k.startswith('utm_') and not k.startswith('ref_'))
|
netloc=parsed_url.netloc,
|
||||||
|
path=parsed_url.path,
|
||||||
new_url = ParseResult(scheme="https",
|
params=parsed_url.params,
|
||||||
netloc=parsed_url.netloc,
|
query=urlencode(filtered, doseq=True),
|
||||||
path=parsed_url.path,
|
fragment=parsed_url.fragment)
|
||||||
params=parsed_url.params,
|
|
||||||
query=urlencode(filtered, doseq=True),
|
|
||||||
fragment=parsed_url.fragment)
|
|
||||||
url = urlunparse(new_url)
|
url = urlunparse(new_url)
|
||||||
|
|
||||||
repost = g.db.query(Submission).filter(
|
repost = g.db.query(Submission).filter(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue