gobuffalo / packr

The simple and easy way to embed static files into Go binaries.
MIT License
3.41k stars 196 forks source link

packr2: file Readdir returns self #162

Closed dkumor closed 5 years ago

dkumor commented 5 years ago

The http.File interface requires Readdir, which is used to list a folder in FileServer when index.html is not present.

Currently, packr's file.Readdir which comes from box.Open returns just a single entry, the directory name itself, see: https://github.com/gobuffalo/packd/blob/master/file.go#L41

This means that Readdir does not actually read the directory, making it impossible to use.

I specifically got caught with this trying to copy a packed folder to the filesystem recursively - Readdir was returning the same folder as its own child.

markbates commented 5 years ago

PRs are welcome.


Mark Bates On Feb 16, 2019, 8:34 AM -0500, Daniel Kumor notifications@github.com, wrote:

The http.File interface requires Readdir, which is used to list a folder in FileServer when index.html is not present. Currently, packr's file.Readdir which comes from box.Open returns just a single entry, the directory name itself, see: https://github.com/gobuffalo/packd/blob/master/file.go#L41 This means that Readdir does not actually read the directory, making it impossible to use. I specifically got caught with this trying to copy a packed folder to the filesystem recursively - Readdir was returning the same folder as its own child. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.