Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: FileServer directory listings are unsorted #11879
The reason I would not do it is that the sorting might by wrong for the user. e.g. I would prefer it to be sorted by mtime for a download.
See https://github.com/mholt/caddy/blob/master/middleware/browse/browse.go how people workaround it right now.
Getting buffering and sorting just to have it sorted wrongly for your use-case sounds like baggage we will regret to me.
Another use case is disabling directory browsing (e.g. for pure asset serving).
So honestly having a more flexible Readdir seems what is needed here as it will benefit all those cases.
"Useful" is not the baseline criterion for inclusion in the standard
There's no way we can build a directory list builder that will satisfy
I don't see the 'browse' package you link to as a work-around.
On 29 July 2015 at 17:40, Ingo Oeser firstname.lastname@example.org wrote:
I think it would be fine to use Readdir(-1). Nearly all directories are small, and more importantly the file system content is under the control of the owner of the server. If they don't want the sorting, they can use their own fork of the directory lister. If they have very very large directories, they probably have other issues.