Skip to content

A malformed request to add a storage is a 400, not a panic - #1

Merged
inkly merged 1 commit into
mainfrom
fix/add-storage-typed-body
Sep 21, 2026
Merged

inkly merged 1 commit into
mainfrom
fix/add-storage-typed-body

Conversation

@inkly

@inkly inkly commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

PostAddStorage, the call that can format a disk, read path, name and format out of a map with unchecked type assertions. A field of the wrong type or a missing path panicked in the handler, which Recover turned into a 500.

The body is a typed struct now: a wrong type is Bind's 400, and a missing path is the empty-path refusal that was already there. Both happen before any disk is touched.

Opened so the tests run on Linux.

PostAddStorage -- the call that can format a disk -- read its body into a
map and took path, name and format out with unchecked type assertions, so a
field of the wrong type or a missing path panicked in the handler (Recover
turned it into a 500). The body is a typed struct now: a wrong type is
Bind's 400 and a missing path is the existing empty-path refusal, both
before any disk is touched.
@inkly
inkly merged commit 62d1b34 into main Sep 21, 2026
1 check passed
@inkly
inkly deleted the fix/add-storage-typed-body branch September 21, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant