working URL uploader

This commit is contained in:
ville rantanen
2018-07-01 19:39:40 +03:00
parent 5c225901f3
commit 99fa595cd4
3 changed files with 18 additions and 11 deletions

View File

@@ -186,6 +186,8 @@ def upload_url():
if request.method == 'POST':
name = request.form['name']
url = request.form['url']
if url == "https://...":
return "", 200
if not is_valid_url(url):
return "URL not valid", 400
(ok,share) = get_share(name)
@@ -200,7 +202,7 @@ def upload_url():
filename = os.path.join(
share['path'],
secure_filename(
os.path.basename(url)
safe_string(url, ".[]()- ", no_repeat = True)
)
)
if os.path.exists(filename):