From ee92098abe818c2801d7134762250d27167f9557 Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 8 Jun 2023 03:32:33 +0300 Subject: [PATCH] fix this https://rdrama.net/post/174840/according-to-siteindicescom-rdramanet-has-a --- files/helpers/actions.py | 4 ++-- files/routes/admin.py | 2 +- files/routes/posts.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 1b8529a8f..235713e30 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -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' diff --git a/files/routes/admin.py b/files/routes/admin.py index bf27a8993..d74582d0f 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -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) diff --git a/files/routes/posts.py b/files/routes/posts.py index 1cec13d6e..bb296325a 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -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