From be39532262b1095740635ed18fb2124c15463a32 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 6 Jul 2020 11:31:00 +0100 Subject: [PATCH] Remove donation url if invalid --- donate.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/donate.py b/donate.py index 48298a9f7..db68f9680 100644 --- a/donate.py +++ b/donate.py @@ -41,6 +41,14 @@ def getDonationUrl(actorJson: {}) -> str: def setDonationUrl(actorJson: {}, donateUrl: str) -> None: """Sets a link used for donations """ + notUrl = False + if '.' not in donateUrl: + notUrl = True + if '://' not in donateUrl: + notUrl = True + if ' ' in donateUrl: + notUrl = True + if not actorJson.get('attachment'): actorJson['attachment'] = [] @@ -65,6 +73,8 @@ def setDonationUrl(actorJson: {}, donateUrl: str) -> None: break if propertyFound: actorJson['attachment'].remove(propertyFound) + if notUrl: + return donateValue = \ '