-
Notifications
You must be signed in to change notification settings - Fork 227
Description
Suppose the following folder structure:
test.txt
folder1/
test2.txt
By default, http.File.Readdir
in golang returns direct child files, so gives [test.txt, folder1/]
However, when I pack the files, File.Readdir
seems to perform a recursive directory listing, and returns [test.txt,folder1,test2.txt]
Note that test2.txt
behaves as if it were in the root folder.
This causes issues in code using Readdir to recursively copy a directory from an embedded filesystem, and causes http.FileServer
to give an incorrect listing when served without index.html
This issue is caused by https://github.com/rakyll/statik/blob/master/fs/fs.go#L163 , which does not check whether the file is in a subpath.
On a related note, empty directories are not listed at all, meaning that it would seem like they are non-existent.