From 27f84e719ac4ed8645e7aa9d6518f9072ad11d31 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Tue, 2 Mar 2021 16:48:04 +0100 Subject: [PATCH 1/2] Content-Type metadata to lower --- server/handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/handlers.go b/server/handlers.go index 02c52aa..f513997 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -383,7 +383,7 @@ type Metadata struct { func MetadataForRequest(contentType string, r *http.Request) Metadata { metadata := Metadata{ - ContentType: contentType, + ContentType: strings.ToLower(contentType), MaxDate: time.Time{}, Downloads: 0, MaxDownloads: -1, From b36711c1eaa26bf3d6350d061a4907a3fe8da517 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Tue, 2 Mar 2021 16:50:53 +0100 Subject: [PATCH 2/2] sanitize only on inline content-disposition --- server/handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/handlers.go b/server/handlers.go index f513997..96213e1 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -1010,7 +1010,7 @@ func (s *Server) getHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("X-Remaining-Days", remainingDays) - if strings.Contains(contentType, "html") { + if disposition == "inline" && strings.Contains(contentType, "html") { reader = ioutil.NopCloser( bytes.NewReader( bluemonday.UGCPolicy().