Closed rmhaiderali closed 3 weeks ago
Hello, and thank you for the report, I will investigate. The index.html file should not be sent at all in your example, so we'll want to fix that 👍
I thought maybe they implemented it this way intentionally. However, it would be more logical not to serve the file at all.
I'm not sure where the error is coming from, but it happens when server is running in a windows environment.
Hello @dougwilson,
Windows intentionally implemented this behavior where, when accessing a path, if it ends with "/", instead of treating it as a directory, it checks if a file with the same name exists. In such cases, it ignores the "/" and allows users to access files as if the path did not end with "/".
I'm unsure about which package (serve-static or send) we should modify to include a check that restricts serving a file if its path ends with "/".
I believe this is resolved here: https://github.com/pillarjs/send/pull/224
I will likely try to land that as the first minor release on send
once we get express@5
out the door. I am going to close this and track this update in send
since that is where the fix should be. @rmhaiderali if you would like to validate the fix there I would greatly appreciate it.
For example, when requesting /index.html/, the server is responding with a Content-Type header set to application/octet-stream instead of text/html.
index.js
public/index.html