Skip to content

Comments

Fix raise_on_missing_only raising on non-matching paths with colons#1298

Merged
josevalim merged 2 commits intoelixir-plug:mainfrom
joshprice:bug/raise_on_missing_only
Feb 23, 2026
Merged

Fix raise_on_missing_only raising on non-matching paths with colons#1298
josevalim merged 2 commits intoelixir-plug:mainfrom
joshprice:bug/raise_on_missing_only

Conversation

@joshprice
Copy link
Contributor

When Plug.Static is mounted at / with raise_on_missing_only: true, application routes containing colons (e.g. /app/resource:id) would raise InvalidPathError because invalid_path? ran before the file existence check.

This fix splits the catch-all status branch into explicit :allowed and :raise clauses so that :raise only fires when a valid path resolves to a real file on disk.

When `Plug.Static` is mounted at `/` with `raise_on_missing_only: true`,
application routes containing colons (e.g. `/app/resource:id`) would i
raise `InvalidPathError` because `invalid_path?` ran before the file
existence check.

This fix splits the catch-all status branch into explicit `:allowed` and
`:raise` clauses so that `:raise` only fires when a valid path resolves
to a real file on disk.
@josevalim josevalim merged commit 59cf2b5 into elixir-plug:main Feb 23, 2026
2 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@joshprice joshprice deleted the bug/raise_on_missing_only branch February 23, 2026 10:09
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.

2 participants