[ARVADOS] updated: 1.3.0-2787-g1e4070240

Git user git at public.arvados.org
Thu Jul 30 20:41:09 UTC 2020


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

       via  1e40702405d04143caa05c9580cce79c293d40d7 (commit)
       via  67288efc74e70a1ac7f511a5eddfb582319fa67b (commit)
      from  682bdcc34462afc37089d7769cf11fda6c04a45c (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 1e40702405d04143caa05c9580cce79c293d40d7
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Thu Jul 30 16:38:34 2020 -0400

    16535: Populate object Size field in ListBucket response.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/services/keep-web/s3.go b/services/keep-web/s3.go
index 05764beee..29de9ce2d 100644
--- a/services/keep-web/s3.go
+++ b/services/keep-web/s3.go
@@ -306,7 +306,9 @@ func (h *handler) s3list(w http.ResponseWriter, r *http.Request, fs arvados.Cust
 			return errDone
 		}
 		resp.Contents = append(resp.Contents, s3.Key{
-			Key: path,
+			Key:          path,
+			LastModified: fi.ModTime().UTC().Format("2006-01-02T15:04:05.999") + "Z",
+			Size:         fi.Size(),
 		})
 		return nil
 	})

commit 67288efc74e70a1ac7f511a5eddfb582319fa67b
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Thu Jul 30 16:38:26 2020 -0400

    16535: Add HeadBucket API.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/services/keep-web/s3.go b/services/keep-web/s3.go
index 7a25e9277..05764beee 100644
--- a/services/keep-web/s3.go
+++ b/services/keep-web/s3.go
@@ -65,8 +65,10 @@ func (h *handler) serveS3(w http.ResponseWriter, r *http.Request) bool {
 	fs := client.SiteFileSystem(kc)
 	fs.ForwardSlashNameSubstitution(h.Config.cluster.Collections.ForwardSlashNameSubstitution)
 
+	objectNameGiven := strings.Count(strings.TrimSuffix(r.URL.Path, "/"), "/") > 1
+
 	switch {
-	case r.Method == "GET" && strings.Count(strings.TrimSuffix(r.URL.Path, "/"), "/") == 1:
+	case r.Method == "GET" && !objectNameGiven:
 		// Path is "/{uuid}" or "/{uuid}/", has no object name
 		if _, ok := r.URL.Query()["versioning"]; ok {
 			// GetBucketVersioning
@@ -78,9 +80,20 @@ func (h *handler) serveS3(w http.ResponseWriter, r *http.Request) bool {
 			h.s3list(w, r, fs)
 		}
 		return true
-	case r.Method == "GET":
+	case r.Method == "GET" || r.Method == "HEAD":
 		fspath := "/by_id" + r.URL.Path
 		fi, err := fs.Stat(fspath)
+		if r.Method == "HEAD" && !objectNameGiven {
+			// HeadBucket
+			if err != nil && fi.IsDir() {
+				w.WriteHeader(http.StatusOK)
+			} else if os.IsNotExist(err) {
+				w.WriteHeader(http.StatusNotFound)
+			} else {
+				http.Error(w, err.Error(), http.StatusBadGateway)
+			}
+			return true
+		}
 		if os.IsNotExist(err) ||
 			(err != nil && err.Error() == "not a directory") ||
 			(fi != nil && fi.IsDir()) {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list