From c6d787c2c7c425adb0716623244fa5ef4188451d Mon Sep 17 00:00:00 2001 From: Lukas Date: Sat, 27 Jun 2026 14:34:11 +0200 Subject: [PATCH] Fix log download Content-Type to application/octet-stream Browser auto-download requires binary MIME type, not text/plain. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Docs/tasks.md | 18 ------------------ src/server/api/logging.py | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/Docs/tasks.md b/Docs/tasks.md index 3ab60ce..8c0f4fe 100644 --- a/Docs/tasks.md +++ b/Docs/tasks.md @@ -1,21 +1,3 @@ -## Task 6: Get Logging Config — Should include level field - -**Test Result:** FAIL — `Dictionary does not contain key 'level'` - -**Instructions:** -The `Get Logging Config` API test expects the response JSON to contain a `level` key, but it is missing. Review the logging configuration endpoint. Ensure the response includes the current logging level (e.g., `INFO`, `DEBUG`, `WARNING`) under the key `level`. - ---- - -## Task 7: Tail Log File — Endpoint should exist and return log tail - -**Test Result:** FAIL — `Url: http://127.0.0.1:8765/api/logging/files/aniworld.log/tail Expected status: 404 != 200` - -**Instructions:** -The `Tail Log File` API test expects a `200 OK` from `/api/logging/files/{filename}/tail`, but gets `404 Not Found`. The endpoint does not exist or the route is incorrect. Implement or fix the route so it accepts a filename parameter and returns the last N lines of the requested log file. - ---- - ## Task 8: Download Log File — Endpoint should exist and return log file **Test Result:** FAIL — `Url: http://127.0.0.1:8765/api/logging/files/aniworld.log/download Expected status: 404 != 200` diff --git a/src/server/api/logging.py b/src/server/api/logging.py index 8a1d131..f88d882 100644 --- a/src/server/api/logging.py +++ b/src/server/api/logging.py @@ -163,7 +163,7 @@ def download_file( return FileResponse( path=str(file_path), filename=safe_name, - media_type="text/plain", + media_type="application/octet-stream", )