Skip to content

Default to HTML handler, not the first #1053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Distribution/Server/Framework/Resource.hs
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,14 @@ serveResource errRes (Resource _ rget rput rpost rdelete rformat rend _) = \dpat
Just answer -> handleErrors (Just format) $ answer dpath
Nothing -> mzero -- return 404 if the specific format is not found
-- return default response when format is empty or non-existent
_ -> do (format,answer) <- negotiateContent (head res) res
handleErrors (Just format) $ answer dpath
_ -> do
let
contentResponsePair =
case find ((== "html") . fst) res of
Just x -> x
Nothing -> head res
(format,answer) <- negotiateContent contentResponsePair res
handleErrors (Just format) $ answer dpath

handleErrors format =
handleErrorResponse (serveErrorResponse errRes format)
Expand Down