Skip to content

Commit e88e25a

Browse files
authored
Default to HTML handler, not the first (#1053)
1 parent 73d008d commit e88e25a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Distribution/Server/Framework/Resource.hs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,14 @@ serveResource errRes (Resource _ rget rput rpost rdelete rformat rend _) = \dpat
464464
Just answer -> handleErrors (Just format) $ answer dpath
465465
Nothing -> mzero -- return 404 if the specific format is not found
466466
-- return default response when format is empty or non-existent
467-
_ -> do (format,answer) <- negotiateContent (head res) res
468-
handleErrors (Just format) $ answer dpath
467+
_ -> do
468+
let
469+
contentResponsePair =
470+
case find ((== "html") . fst) res of
471+
Just x -> x
472+
Nothing -> head res
473+
(format,answer) <- negotiateContent contentResponsePair res
474+
handleErrors (Just format) $ answer dpath
469475

470476
handleErrors format =
471477
handleErrorResponse (serveErrorResponse errRes format)

0 commit comments

Comments
 (0)