cachebust: don't 500 on non-existant files

This commit is contained in:
codl 2017-08-20 12:43:29 +02:00
parent 58fd10977e
commit fc58833bf5
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 4 additions and 1 deletions

View File

@ -4,7 +4,10 @@ def cachebust(app):
@app.route('/static-<int:timestamp>/<path:filename>')
def static_cachebust(timestamp, filename):
path = os.path.join(app.static_folder, filename)
mtime = os.stat(path).st_mtime
try:
mtime = os.stat(path).st_mtime
except Exception:
return abort(404)
if abs(mtime - timestamp) > 1:
abort(404)
else: