Keep server details out of API answers

An unexpected error now sends a general message, and the log keeps the
text. A job no longer shows the path of its uploaded file. A cover is
cached only by the browser of the user.
This commit is contained in:
tim
2026-10-02 23:37:33 +02:00
parent 0edfa1308c
commit e196d1688e
5 changed files with 19 additions and 4 deletions
+3 -2
View File
@@ -145,8 +145,9 @@ def test_download_builds_from_stored_chapters_without_changing_them(client, stor
response.close()
def test_unexpected_backend_error_returns_json(client, monkeypatch):
def test_unexpected_backend_error_returns_json(client, monkeypatch, caplog):
monkeypatch.setattr(o, "list_stories", Mock(side_effect=RuntimeError("broken")))
response = client.get("/api/stories")
assert response.status_code == 500
assert response.json == {"error": "RuntimeError: broken"}
assert response.json == {"error": "Bindery hit an unexpected error. The log has the details."}
assert "RuntimeError: broken" in caplog.text