-
-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(serveStatic): add guard to prevent reading empty folders #3639
Conversation
I think this function is supposed to determine if the path is a directory... https://github.com/honojs/hono/blob/main/src/adapter/deno/serve-static.ts#L25 Am I mistaken...? |
Adding the following to the beginning of your pull request is useful because it will automatically close the issue when it is merged! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3639 +/- ##
==========================================
+ Coverage 90.52% 91.68% +1.15%
==========================================
Files 159 159
Lines 10179 10135 -44
Branches 2843 2862 +19
==========================================
+ Hits 9215 9292 +77
+ Misses 962 841 -121
Partials 2 2 ☔ View full report in Codecov by Sentry. |
Hi @oussamasf ! Thank you for the PR. Seems to be good. But, we need to write tests. Could you add a test for it? You can put it to |
@EdamAme-x I replaced stat with the existing function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Looks good to me! Thank you for your contribution. |
Thank you for fixing this! |
#3628
This PR addresses an issue where attempting to open an empty directory with
Deno.open
returns aReadableStream
, causing unexpected behavior. Specifically, it leads to a status code200
instead of the expected 404 for directories.bun run format:fix && bun run lint:fix
to format the code