mirror of
https://github.com/codl/forget
synced 2025-01-23 04:12:28 +01:00
cachebust: don't 500 on non-existant files
This commit is contained in:
parent
58fd10977e
commit
fc58833bf5
@ -4,7 +4,10 @@ def cachebust(app):
|
|||||||
@app.route('/static-<int:timestamp>/<path:filename>')
|
@app.route('/static-<int:timestamp>/<path:filename>')
|
||||||
def static_cachebust(timestamp, filename):
|
def static_cachebust(timestamp, filename):
|
||||||
path = os.path.join(app.static_folder, 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:
|
if abs(mtime - timestamp) > 1:
|
||||||
abort(404)
|
abort(404)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user