From bf72234873d7abc77724af1ce889fdcba21b5b89 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 26 Nov 2022 03:45:20 +0200 Subject: [PATCH] remove SITE url from badge urls to make them relative in the event of a future domain change --- files/routes/admin.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 047e10a65..7d5c45b1b 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -546,9 +546,11 @@ def badge_grant_post(v): if desc: new_badge.description = desc url = request.values.get("url") - if '\\' in url: abort(400) - - if url: new_badge.url = url + if url: + if '\\' in url: abort(400) + if url.startswith(SITE_FULL): + url = url.split(SITE_FULL, 1)[1] + new_badge.url = url g.db.add(new_badge) g.db.flush()