From ba95046e8464e4cb6e97fa51da6254ccf2efeb7e Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Mon, 22 Mar 2021 01:09:00 +0000 Subject: [PATCH] fup: add additional mimetypes to pretty page --- web/fup/fuphttp/fuphttp.go | 5 ++++- web/fup/fuphttp/httpview.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/web/fup/fuphttp/fuphttp.go b/web/fup/fuphttp/fuphttp.go index 41a82b741c..f478bb9a32 100644 --- a/web/fup/fuphttp/fuphttp.go +++ b/web/fup/fuphttp/fuphttp.go @@ -83,7 +83,10 @@ type Application struct { } func DefaultUseDirectDownload(fileExtension, mimeType string) bool { - // Only use the pretty page for text/*. + switch mimeType { + case "application/json", "application/xml", "application/xhtml+xml", "application/x-csh", "application/x-sh": + return false + } return !strings.HasPrefix(mimeType, "text/") } diff --git a/web/fup/fuphttp/httpview.go b/web/fup/fuphttp/httpview.go index daeff64bc5..7755e5fc83 100644 --- a/web/fup/fuphttp/httpview.go +++ b/web/fup/fuphttp/httpview.go @@ -33,7 +33,7 @@ func renderAsCode(mimeType string) bool { return true } switch mimeType { - case "application/json", "application/xml": + case "application/json", "application/xml", "application/xhtml+xml", "application/x-csh", "application/x-sh": return true } return false