Directory with `5.0` in path always serves 404
JustinBeckwith opened this issue ยท 2 comments
Lovely library - thank you for building it! I ran into a rather bizarre problem when trying to debug JustinBeckwith/linkinator#233. There is a route that looks like http://localhost:3000/docs/5.0/
which always returns a 404, even with an index.html
in that local directory. I have a full simple reproduction here:
https://github.com/JustinBeckwith/serve-bug
The code is simple enough:
const http = require('http');
const serve = require('serve-handler');
http.createServer((req, res) => {
return serve(req, res, {
public: '.',
directoryListing: false,
});
})
.listen(3000);
With a directory structure like this:
/
docs/
normal/
index.html
6/
index.html
5.0/
index.html
The routes that go to docs/normal
and docs/6
work - only the 5.0
route causes a 404. Please do let me know if there's anything else I can do to help with a reproduction.
cc @XhmikosR
@JustinBeckwith I had a quick look at this and it seems we need
- to set
renderSingle: true
- and change the
=== 1
check to>= 1
here:
Line 342 in c7a4043
Then linkinator is passing here:
> bootstrap@5.0.0-beta1 docs-linkinator C:\Users\xmr\Desktop\bootstrap
> linkinator _gh_pages --recurse --silent --skip "^(?!http://localhost)"
๐โโ๏ธ crawling _gh_pages
renderSingle: true
canRenderSingle: true
files.length: 15
๐ค Successfully scanned 700 links in 2.942 seconds.
docs/5.0/
contents:
Directory of C:\Users\xmr\Desktop\bootstrap\_gh_pages\docs\5.0
25/01/2021 14:58 <DIR> .
25/01/2021 14:58 <DIR> ..
25/01/2021 14:58 <DIR> about
25/01/2021 14:58 <DIR> assets
25/01/2021 14:58 <DIR> components
25/01/2021 14:58 <DIR> content
25/01/2021 14:58 <DIR> customize
31/08/1754 00:43 <DIR> dist
25/01/2021 14:58 <DIR> examples
25/01/2021 14:58 <DIR> extend
25/01/2021 14:58 <DIR> forms
25/01/2021 14:58 <DIR> getting-started
25/01/2021 14:58 <DIR> helpers
25/01/2021 14:58 498 index.html
25/01/2021 14:58 <DIR> layout
25/01/2021 14:58 <DIR> migration
25/01/2021 14:58 <DIR> utilities
I haven't tested it with unit tests since I'm having trouble setting up the repo on vanilla Windows 10.
@styfle friendly CC in case you can help us here :)
EDIT: Alternatively, maybe the check should look for other sibling folders too or something?
EDIT2: BTW this might be a duplicate of #120?