GET /proxy with no parameters raises an unhandled exception (500) #14
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
paul_loth/krautspaceTV#14
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
`/proxy` (backend/app.py) defaults `url: str = ""` when no `slide_id` is given. Calling it with no parameters at all (`GET /proxy`) passes an empty string to `httpx.AsyncClient().get(url, ...)`, which raises an exception (invalid/missing URL) that nothing catches — FastAPI turns it into a raw 500.
Reproduced: `curl http://127.0.0.1:8081/proxy` → `500`.
Since `/proxy` is intentionally open on the network (by design, see #2), it should fail cleanly for bad/missing input rather than raising.
Suggested fix
Validate up front: if `slide_id` is None and `url` is empty (or doesn't look like a valid absolute URL), return a 400 with a short message instead of proceeding to the fetch.
Fixed in
0bcc65e: /proxy now returns 400 if url is missing/has no scheme, and 502 (instead of an unhandled 500) if the upstream fetch itself fails. Verified live: bare GET /proxy -> 400, url pointing at an unreachable host -> 502, normal slide_id proxying still works (200).