Browse Source

Fix handling of empty requests

fix_empty_req
sqozz 1 year ago
parent
commit
eda9cae667
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      schort.py

+ 2
- 1
schort.py View File

@@ -36,10 +36,11 @@ def short(shortLink=""):
36 36
 		else:
37 37
 			return render_template("index.html", name=shortLink) # Landing page
38 38
 	elif request.method == "POST": # Someone submitted a new link to short
39
-		longUrl = request.form["url"] # required, accept the exception if the key does not exist
39
+		longUrl = request.form.get("url", "")
40 40
 		wishId = request.form.get("wishId")
41 41
 		if len(longUrl) <= 0:
42 42
 			abort(400)
43
+
43 44
 		databaseId = insertIdUnique(longUrl, idToCheck=wishId)
44 45
 		return request.url_root + databaseId # Short link in plain text
45 46
 

Loading…
Cancel
Save