remove SITE url from badge urls to make them relative in the event of a future domain change

pull/16/head
Aevann1 2022-11-26 03:45:20 +02:00
parent 9fe0bcfc58
commit bf72234873
1 changed files with 5 additions and 3 deletions

View File

@ -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()