From 63c8d9923ea5c9726c140622ed411fe7d6af1a6e Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sun, 25 Feb 2024 12:39:49 +1100 Subject: [PATCH] feat: Auto add https to links --- main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.py b/main.py index 199af57..9abb0d8 100644 --- a/main.py +++ b/main.py @@ -191,6 +191,14 @@ def site_post(): # Remove empty socials and addresses socials = [i for i in socials if i['url'] != ''] + # Make sure links all start with http or https + for i in socials: + # Set link to lowercase + i['url'] = i['url'].lower() + if not i['url'].startswith('http'): + i['url'] = 'https://' + i['url'] + + data['socials'] = socials address = [i for i in address if i['address'] != ''] data['address'] = address