From 465160dbe68310c2175f55791f3e76af86fccc99 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 18 Oct 2022 13:09:53 +0200 Subject: [PATCH] dont include SITE_FULL in post urls --- files/helpers/media.py | 8 ++++---- files/routes/comments.py | 4 ++-- files/routes/posts.py | 3 +++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/files/helpers/media.py b/files/helpers/media.py index 1b7408223..9954af6f3 100644 --- a/files/helpers/media.py +++ b/files/helpers/media.py @@ -25,9 +25,9 @@ def process_files(): url = process_image(name, patron=g.v.patron) body += f"\n\n![]({url})" elif file.content_type.startswith('video/'): - body += f"\n\n{process_video(file)}" + body += f"\n\n{SITE_FULL}{process_video(file)}" elif file.content_type.startswith('audio/'): - body += f"\n\n{process_audio(file)}" + body += f"\n\n{SITE_FULL}{process_audio(file)}" else: abort(415) return body @@ -59,7 +59,7 @@ def process_audio(file): ) g.db.add(media) - return f'{SITE_FULL}{name}' + return name def webm_to_mp4(old, new, vid): @@ -117,7 +117,7 @@ def process_video(file): ) g.db.add(media) - return f'{SITE_FULL}{new}' + return new diff --git a/files/routes/comments.py b/files/routes/comments.py index 4465b82ee..1a61c3a70 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -220,9 +220,9 @@ def comment(v): abort(400, str(e)) body += f"\n\n![]({image})" elif file.content_type.startswith('video/'): - body += f"\n\n{process_video(file)}" + body += f"\n\n{SITE_FULL}{process_video(file)}" elif file.content_type.startswith('audio/'): - body += f"\n\n{process_audio(file)}" + body += f"\n\n{SITE_FULL}{process_audio(file)}" else: abort(415) diff --git a/files/routes/posts.py b/files/routes/posts.py index 1198debb3..88e44b2c8 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -882,6 +882,9 @@ def submit_post(v, sub=None): if embed: embed = embed.strip() + if url and url.startswith(SITE_FULL): + url = url.split(SITE_FULL)[1] + post = Submission( private=bool(request.values.get("private","")), notify=bool(request.values.get("notify","")),