handle incorrect hash

This commit is contained in:
2019-10-31 12:53:53 +02:00
parent b26dbf3216
commit b8bffcc587
2 changed files with 3 additions and 0 deletions

View File

@@ -526,6 +526,8 @@ def logout(name):
@app.route('/e/<ehash>/<filename>', methods=['GET']) @app.route('/e/<ehash>/<filename>', methods=['GET'])
def download_expiring(ehash, filename = None): def download_expiring(ehash, filename = None):
file_path, expiring = get_expiring_file(ehash) file_path, expiring = get_expiring_file(ehash)
if file_path == None:
return 'No such link', 404
if not os.path.exists(file_path): if not os.path.exists(file_path):
return 'No such file', 404 return 'No such file', 404
if expiring - time.time() < 0: if expiring - time.time() < 0:

View File

@@ -90,6 +90,7 @@ def expire_database_create():
file text NOT NULL, file text NOT NULL,
expires integer NOT NULL expires integer NOT NULL
);""") );""")
# Clear out expired items
cursor.execute("DELETE FROM expiring WHERE expires < ?", cursor.execute("DELETE FROM expiring WHERE expires < ?",
( (
time.time(), time.time(),