Added database exception, just in case and fixed a typo

This commit is contained in:
Dominik V. Salonen 2015-12-24 13:06:34 +01:00
parent f9f7d16fad
commit 47c37a9fc7
1 changed files with 5 additions and 2 deletions

5
run.py
View File

@ -64,7 +64,7 @@ def allowed_file(filename):
@app.route('/', methods=['GET', 'POST'])
def upload_file():
if request.method == 'POST':
print_log('Web', 'New file Relieved')
print_log('Web', 'New file Received')
if not auth(request.headers.get('X-Hyozan-Auth')):
abort(403)
data = dict()
@ -109,7 +109,10 @@ def terms():
@app.route('/<filename>', methods=['GET'])
def get_file(filename):
print_log('Web', 'Hit "' + filename + '" - ' + time_to_string(time.time()))
try:
db.update_file(filename)
except Exception:
print_log('Warning', 'Unable to update access time. Is the file in the database?')
return send_from_directory(config['UPLOAD_FOLDER'], filename)
@app.route('/share/<filename>')