handle incorrect hash
This commit is contained in:
@@ -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:
|
||||||
|
|||||||
@@ -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(),
|
||||||
|
|||||||
Reference in New Issue
Block a user