You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I already searched, and this feature request or improvement is not a duplicate.
Feature scope
Improve existing functionality
Feature request related to a problem
As things are now, the decision between HTML and JSON directory listings is made in the configuration. I am unsure about the reasoning behind that, but that’s actually exactly what the Accept header is for.
Describe the solution you'd like
Use content negotiation via the Accept header to decide on the directory listing format. There is already QualityValue in the tree, it can be reused to parse the Accept header. If application/json comes up first, the format should be JSON. If text/html is found first, it should be HTML. Default if none of the two are present should be HTML.
If necessary, there can also be an explicit format query parameter to override the header.
The config setting can be removed then – or ignored with a warning to keep existing configs working.
Describe alternatives you've considered
Build target
All targets
Additional context
No response
The text was updated successfully, but these errors were encountered:
The idea is not bad. We could use similar logic when working with the Accept-Encoding but of course under the --directory-listing being enabled.
I think that this feature should complement what we already have, I mean the --directory-listing-format.
For example, an idea that comes to mind could be to introduce a new entry in the DirListFmt enum like Auto or something to tell SWS to determine the directory listing format automatically via the Accept header rather than using --directory-listing-format.
Search for duplicate feature request
Feature scope
Improve existing functionality
Feature request related to a problem
As things are now, the decision between HTML and JSON directory listings is made in the configuration. I am unsure about the reasoning behind that, but that’s actually exactly what the
Accept
header is for.Describe the solution you'd like
Use content negotiation via the
Accept
header to decide on the directory listing format. There is alreadyQualityValue
in the tree, it can be reused to parse theAccept
header. Ifapplication/json
comes up first, the format should be JSON. Iftext/html
is found first, it should be HTML. Default if none of the two are present should be HTML.If necessary, there can also be an explicit
format
query parameter to override the header.The config setting can be removed then – or ignored with a warning to keep existing configs working.
Describe alternatives you've considered
Build target
All targets
Additional context
No response
The text was updated successfully, but these errors were encountered: