add route for log file deletion

This commit is contained in:
Stefan Allius
2025-05-02 17:04:03 +02:00
parent aadbe6855e
commit 97b19a6ffc

View File

@@ -50,3 +50,12 @@ async def send(file):
directory=Config.get_log_path(),
file_name=secure_filename(file),
as_attachment=True)
@web.route('/del-file/<file>', methods=['DELETE'])
async def delete(file):
try:
os.remove(Config.get_log_path() + secure_filename(file))
except OSError:
return 'File not found', 404
return '', 204