Aevann 2023-06-08 03:32:33 +03:00
parent 0bca73563a
commit ee92098abe
3 changed files with 4 additions and 4 deletions

View File

@ -149,7 +149,7 @@ def execute_snappy(post:Post, v:User):
body += "\n\n"
if post.url and not post.url.startswith('/') and not post.url.startswith(SITE_FULL) and not post.url.startswith(SITE_FULL_IMAGES):
if post.url and not post.url.startswith('/') and not post.url.startswith(f'{SITE_FULL}/') and not post.url.startswith(SITE_FULL_IMAGES):
if post.url.startswith('https://old.reddit.com/r/'):
rev = post.url.replace('https://old.reddit.com/', '')
rev = f"* [unddit.com](https://unddit.com/{rev})\n\n"
@ -178,7 +178,7 @@ def execute_snappy(post:Post, v:User):
for href, title in captured:
if href.startswith(SITE_FULL) or href.startswith(SITE_FULL_IMAGES): continue
if href.startswith(f'{SITE_FULL}/') or href.startswith(SITE_FULL_IMAGES): continue
if "Snapshots:\n\n" not in body: body += "Snapshots:\n\n"
if f'**[{title}]({href})**:\n\n' not in body:
addition = f'**[{title}]({href})**:\n\n'

View File

@ -467,7 +467,7 @@ def badge_grant_post(v):
if url:
if '\\' in url: abort(400)
if url.startswith(SITE_FULL):
if url.startswith(f'{SITE_FULL}/'):
url = url.split(SITE_FULL, 1)[1]
existing = user.has_badge(badge_id)

View File

@ -586,7 +586,7 @@ def submit_post(v:User, sub=None):
if embed and len(embed) > 1500: embed = None
if embed: embed = embed.strip()
if url and url.startswith(SITE_FULL):
if url and url.startswith(f'{SITE_FULL}/'):
url = url.split(SITE_FULL)[1]
if url == '': url = None