[ARVADOS] updated: 24b137a5b3313778e2db7f5d1e0c82daf0634a9c

Git user git at public.curoverse.com
Fri Jan 27 02:31:23 EST 2017


Summary of changes:
 services/keep-web/handler.go | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

       via  24b137a5b3313778e2db7f5d1e0c82daf0634a9c (commit)
      from  b001425779a0189b357c4e3a47734eda6b77ce2d (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 24b137a5b3313778e2db7f5d1e0c82daf0634a9c
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jan 27 02:27:23 2017 -0500

    10990: Remove superfluous code for headers now handled by http.ServeContent.

diff --git a/services/keep-web/handler.go b/services/keep-web/handler.go
index 8dee88d..db7517a 100644
--- a/services/keep-web/handler.go
+++ b/services/keep-web/handler.go
@@ -4,7 +4,6 @@ import (
 	"fmt"
 	"html"
 	"io"
-	"mime"
 	"net/http"
 	"net/url"
 	"os"
@@ -336,29 +335,15 @@ func (h *handler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
 	}
 	defer rdr.Close()
 
-	basenamePos := strings.LastIndex(filename, "/")
-	if basenamePos < 0 {
-		basenamePos = 0
-	}
-	extPos := strings.LastIndex(filename, ".")
-	if extPos > basenamePos {
-		// Now extPos is safely >= 0.
-		if t := mime.TypeByExtension(filename[extPos:]); t != "" {
-			w.Header().Set("Content-Type", t)
-		}
-	}
-	if rdr, ok := rdr.(keepclient.Reader); ok {
-		w.Header().Set("Content-Length", fmt.Sprintf("%d", rdr.Len()))
-	}
-
-	applyContentDispositionHdr(w, r, filename[basenamePos:], attachment)
+	basename := path.Base(filename)
+	applyContentDispositionHdr(w, r, basename, attachment)
 
 	modstr, _ := collection["modified_at"].(string)
 	modtime, err := time.Parse(time.RFC3339Nano, modstr)
 	if err != nil {
 		modtime = time.Now()
 	}
-	http.ServeContent(w, r, path.Base(filename), modtime, rdr)
+	http.ServeContent(w, r, basename, modtime, rdr)
 }
 
 func applyContentDispositionHdr(w http.ResponseWriter, r *http.Request, filename string, isAttachment bool) {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list