Open
Description
Expected behavior
If the requested URL points to a folder with an index.html
file and it is missing a slash at the end, the server should respond with a redirect with a slash added at the end.
Actual behavior
If the requested URL points to a folder with an index.html
file and it is missing a slash at the end, the server does not redirect with the slash added, making the browser think that the folder name is a file name, which in turn makes relative URLs work differently depending on whether or not the slash is present.
How to reproduce
- Download and unpack this tiny project: koa-static-folder-bug.zip
npm install
andnpm start
- Open
http://localhost:3000/folder
. Observe that no redirect took place. The image of a black square is displayed, even thoughimage.png
is in the parent directory offolder/index.html
. - Open
http://localhost:3000/folder/
. Observe that the image is (correctly) not displayed.