Caddy: browse: wrong alphabetic ordering

Created on 25 Mar 2017  ·  5Comments  ·  Source: caddyserver/caddy

With Caddy from HEAD (0.9.5),
I am browsing a directory with lots of files (binhost from Gentoo's portage tree, by the way) alphabetically.

expected

glibc next to glibc-2.25-r22.tgz. (Exemplary.)

experienced

Directory entries are scattered. Finding an entry becomes cumbersome. If it were for a few files I would just spot them and don't care about the order.

Most helpful comment

@wmark Thanks for the issue, I'll take a look

All 5 comments

Output obtained using application/json is in the wrong order, too, while it's supposed to be already sorted.

1527 has introduced the breaking change.

If any special non-standard ordering were wanted for text/html (I'd veto'd it), it should be implemented in that view only and not in the model, where it affects all views. ← Which would fix this issue, as would reverting the aforementioned commit.

@wmark Thanks for the issue, I'll take a look

You might wonder why sorting by size got a special treatment. For a consistent user experience we sort of standardized it.

This is due to filesystems interpreting size of a directory differently. Some set it to 0, some to (i)node-size, node-size + embedded content, some to the sum of the actual or apparent size of its contents (one level or ∞ levels deep). Go figure.

@wmark I have pushed a PR that introduces a new sort type 'alpha' which will provide the original sort order ignoring file or dir type. You simply need to specify sort in url

curl --header "Accept: application/json"   http://courgette.kinchik.ie?sort=alpha

Does this solve your issue? If possible I would rather not introduce differnt behavior based on a differnt view of the same data.

I'll close this now - fixed in PR #1551

Was this page helpful?
0 / 5 - 0 ratings