WebHost: offer room owner log download link

This commit is contained in:
Fabian Dill
2023-04-21 15:12:43 +02:00
committed by Fabian Dill
parent 28c5e9ee65
commit 42da24cb5e
2 changed files with 17 additions and 8 deletions

View File

@@ -116,7 +116,11 @@ def display_log(room: UUID):
if room is None:
return abort(404)
if room.owner == session["_id"]:
return Response(_read_log(os.path.join("logs", str(room.id) + ".txt")), mimetype="text/plain;charset=UTF-8")
file_path = os.path.join("logs", str(room.id) + ".txt")
if os.path.exists(file_path):
return Response(_read_log(file_path), mimetype="text/plain;charset=UTF-8")
return "Log File does not exist."
return "Access Denied", 403