Fix: Return .html file when file and folder share name #1155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Netlify ❤️,
I'm submitting this PR as suggested by @erezrokah in order to fix issue #1017.
- Summary
When you have a folder and a file with the same name (e.g., foo.html and foo/), Netlify will serve the contents of foo.html.
Until now, netlify dev was inconsistent with that behavior and returned a 403 Forbidden error in this scenario (because directory listings are forbidden).
This PR makes netlify dev behave consistent with Netlify by serving the .html (or .htm) file instead of returning 403 Forbidden.
Fixes: #1017
- Test plan
I first added a test to
tests/command.dev.test.js
. I ran the test and confirmed that it failed. Then I implemented the fix. I reran the test and the test passed.I ran
npm run test
and everything came back green.- Description for the changelog
Fix: Return .html file when file and folder share name (#1017)
- A picture of a cute animal (not mandatory but encouraged)
Happy to make any changes/improvements you deem necessary! Thanks for all your great work 🙌