valyala / fasthttp

Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http
MIT License
21.91k stars 1.76k forks source link

fs: fix GenerateIndexPages when DirFS or embed.FS is used #1778

Closed efectn closed 6 months ago

efectn commented 6 months ago

In current implementation of Fasthttp FS, GenerateIndexPages doesn't work properly with DirFS or embed.FS because of fs.ValidPath function.

When you open "" path using with DirFS it returns invalid path error. When using embed.FS, it returns file does not exist error.

So, if the path is "" both cases need to covered properly.

Note: I ain't also sure this is a good solution. Perhaps need smarter solution to cover more edge cases.

erikdubbelboer commented 6 months ago

Thanks!