8784: Just pass collection name to serveDirectory, not whole record.
authorTom Clegg <tom@curoverse.com>
Thu, 15 Jun 2017 21:01:28 +0000 (17:01 -0400)
committerTom Clegg <tom@curoverse.com>
Thu, 15 Jun 2017 21:02:04 +0000 (17:02 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curoverse.com>

services/keep-web/handler.go

index 17be60321f10a3ed89bd56c3e4bbde5d0bf8d4f5..ecc698256a2e8d4b3f815f5ba73b92c5077f900f 100644 (file)
@@ -329,7 +329,7 @@ func (h *handler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
        } else if stat.IsDir() && !strings.HasSuffix(r.URL.Path, "/") {
                h.seeOtherWithCookie(w, r, basename+"/", credentialsOK)
        } else if stat.IsDir() {
-               h.serveDirectory(w, r, collection, fs, openPath, stripParts)
+               h.serveDirectory(w, r, collection.Name, fs, openPath, stripParts)
        } else {
                http.ServeContent(w, r, basename, stat.ModTime(), f)
                if int64(w.WroteBodyBytes()) != stat.Size() {
@@ -367,7 +367,7 @@ var dirListingTemplate = `<!DOCTYPE HTML>
   </STYLE>
 </HEAD>
 <BODY>
-<H1>{{ .Collection.Name }}</H1>
+<H1>{{ .CollectionName }}</H1>
 
 <P>This collection of data files is being shared with you through
 Arvados.  You can download individual files listed below.  To download
@@ -399,7 +399,7 @@ type fileListEnt struct {
        Size int64
 }
 
-func (h *handler) serveDirectory(w http.ResponseWriter, r *http.Request, collection *arvados.Collection, fs http.FileSystem, base string, stripParts int) {
+func (h *handler) serveDirectory(w http.ResponseWriter, r *http.Request, collectionName string, fs http.FileSystem, base string, stripParts int) {
        var files []fileListEnt
        var walk func(string) error
        if !strings.HasSuffix(base, "/") {
@@ -453,10 +453,10 @@ func (h *handler) serveDirectory(w http.ResponseWriter, r *http.Request, collect
        })
        w.WriteHeader(http.StatusOK)
        tmpl.Execute(w, map[string]interface{}{
-               "Collection": collection,
-               "Files":      files,
-               "Request":    r,
-               "StripParts": stripParts,
+               "CollectionName": collectionName,
+               "Files":          files,
+               "Request":        r,
+               "StripParts":     stripParts,
        })
 }