Skip to content
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: Return .html file when file and folder share name #1155

Merged

Conversation

FinnWoelm
Copy link
Contributor

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)

WhatsApp Image 2019-12-25 at 2 04 28 PM (1)

Happy to make any changes/improvements you deem necessary! Thanks for all your great work 🙌

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 (because directory listings are forbidden) in this
scenario. This commit makes netlify dev behave consistent with Netlify
by serving the .html (or .htm) file instead of returning 403 Forbidden.

Fixes: netlify#1017
@netlify
Copy link

netlify bot commented Aug 27, 2020

Deploy request for cli accepted.

Accepted with commit d0eb2d1

https://app.netlify.com/sites/cli/deploys/5f47b9f2074b4f0007c6186e

@erezrokah erezrokah added the type: bug code to address defects in shipped code label Aug 27, 2020
@erezrokah erezrokah self-requested a review August 27, 2020 14:38
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great @FinnWoelm!
Thank you for adding the test case for it too ❤️

@erezrokah erezrokah merged commit 0762d6d into netlify:master Aug 27, 2020
@FinnWoelm FinnWoelm deleted the fix/file-and-folder-with-same-name branch August 27, 2020 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

403 Forbidden when Folder and File share name (e.g. hello/ and hello.html)
2 participants