Skip to content

fix(filesystem) :: return 404 when a request resolves to a directory - #1411

Merged
lovasoa merged 2 commits into
sqlpage:mainfrom
81reap:mutation/03-directory-returns-404
Sep 1, 2026
Merged

fix(filesystem) :: return 404 when a request resolves to a directory#1411
lovasoa merged 2 commits into
sqlpage:mainfrom
81reap:mutation/03-directory-returns-404

Conversation

@81reap

@81reap 81reap commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

When a directory name has a file extension it is routed to the static file handler and fails with IsADirectory and shows a 500 error page. Now it resolves to 404.

@81reap
81reap marked this pull request as draft August 31, 2026 20:18
@81reap
81reap force-pushed the mutation/03-directory-returns-404 branch from 795386b to bfa7d9f Compare August 31, 2026 20:41
@81reap

81reap commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

CI failed for unrelated reasons, fixed in #1416

@81reap
81reap marked this pull request as ready for review August 31, 2026 21:16
Comment thread CHANGELOG.md Outdated
Comment thread src/filesystem.rs
When a directory name contains a dot the request is routed to the static file handler, which fails to read it and renders an error page.

Reading a directory reports `IsADirectory` on unix but `PermissionDenied` on windows, so the status is decided by inspecting the path rather than by the error kind. The regression test covers both platforms: on unix it also exercises the windows branch, since `IsADirectory` is no longer special-cased.
@81reap
81reap force-pushed the mutation/03-directory-returns-404 branch from bfa7d9f to 07ddace Compare September 1, 2026 23:17
@81reap
81reap requested a review from lovasoa September 1, 2026 23:17
@lovasoa
lovasoa merged commit 0ad49b6 into sqlpage:main Sep 1, 2026
51 checks passed
@81reap
81reap deleted the mutation/03-directory-returns-404 branch September 1, 2026 23:33
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