Fix requests with empty wish-URLs

This commit is contained in:
sqozz 2018-04-07 23:03:54 +02:00
parent d02c458e2a
commit b98c189f7c

View file

@ -43,7 +43,7 @@ def short(shortLink=""):
def insertIdUnique(longUrl, idToCheck=None):
hashUrl = hashlib.sha256(longUrl.encode()).digest()
base64Url = base64.urlsafe_b64encode(hashUrl).decode()
if idToCheck == None:
if idToCheck == None or idToCheck == "":
idToCheck = base64Url[:4]
conn = sqlite3.connect("data/links.sqlite")