Fix requests with empty wish-URLs
This commit is contained in:
parent
d02c458e2a
commit
b98c189f7c
|
@ -43,7 +43,7 @@ def short(shortLink=""):
|
||||||
def insertIdUnique(longUrl, idToCheck=None):
|
def insertIdUnique(longUrl, idToCheck=None):
|
||||||
hashUrl = hashlib.sha256(longUrl.encode()).digest()
|
hashUrl = hashlib.sha256(longUrl.encode()).digest()
|
||||||
base64Url = base64.urlsafe_b64encode(hashUrl).decode()
|
base64Url = base64.urlsafe_b64encode(hashUrl).decode()
|
||||||
if idToCheck == None:
|
if idToCheck == None or idToCheck == "":
|
||||||
idToCheck = base64Url[:4]
|
idToCheck = base64Url[:4]
|
||||||
|
|
||||||
conn = sqlite3.connect("data/links.sqlite")
|
conn = sqlite3.connect("data/links.sqlite")
|
||||||
|
|
Loading…
Reference in a new issue