[arvados] updated: 2.1.0-2616-g0d8b4f1ad

git repository hosting git at public.arvados.org
Mon Aug 22 14:48:06 UTC 2022


Summary of changes:
 services/keep-web/s3.go | 13 +++++++++++++
 1 file changed, 13 insertions(+)

       via  0d8b4f1ad827a575bf74b058426eb898257592e5 (commit)
      from  265afdad112b129c36235935470d4a410161a9ef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 0d8b4f1ad827a575bf74b058426eb898257592e5
Author: Tom Clegg <tom at curii.com>
Date:   Tue Aug 9 11:19:40 2022 -0400

    19368: Do not read content to sniff content-type for S3 requests.
    
    refs #19368
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/services/keep-web/s3.go b/services/keep-web/s3.go
index 59ab3cd43..3316d1632 100644
--- a/services/keep-web/s3.go
+++ b/services/keep-web/s3.go
@@ -13,6 +13,7 @@ import (
 	"fmt"
 	"hash"
 	"io"
+	"mime"
 	"net/http"
 	"net/url"
 	"os"
@@ -415,6 +416,18 @@ func (h *handler) serveS3(w http.ResponseWriter, r *http.Request) bool {
 		// shallow copy r, and change URL path
 		r := *r
 		r.URL.Path = fspath
+
+		// Determine content-type from file extension. But
+		// unlike the default http.FileServer behavior, if
+		// mime.TypeByExtension returns nothing, use
+		// "application/octet-stream" instead of sniffing
+		// content.
+		ctype := mime.TypeByExtension(filepath.Ext(fspath))
+		if ctype == "" {
+			ctype = "application/octet-stream"
+		}
+		w.Header().Set("Content-Type", ctype)
+
 		http.FileServer(fs).ServeHTTP(w, &r)
 		return true
 	case r.Method == http.MethodPut:

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list