12483: Enable rename via webdav.
authorTom Clegg <tclegg@veritasgenetics.com>
Fri, 17 Nov 2017 16:38:13 +0000 (11:38 -0500)
committerTom Clegg <tclegg@veritasgenetics.com>
Sat, 18 Nov 2017 07:28:40 +0000 (02:28 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

services/keep-web/handler.go
services/keep-web/handler_test.go
services/keep-web/webdav.go

index 42f6c513bbd98b52b723871cb3f5f5ba17aca66f..f6c12c3d85558550bd485dc3dc9353ad3c15520f 100644 (file)
@@ -98,6 +98,7 @@ func (h *handler) serveStatus(w http.ResponseWriter, r *http.Request) {
 
 var (
        webdavMethod = map[string]bool{
+               "MOVE":     true,
                "OPTIONS":  true,
                "PROPFIND": true,
                "PUT":      true,
@@ -148,7 +149,7 @@ func (h *handler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
                        return
                }
                w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, Range")
-               w.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PROPFIND, PUT")
+               w.Header().Set("Access-Control-Allow-Methods", "GET, MOVE, OPTIONS, POST, PROPFIND, PUT")
                w.Header().Set("Access-Control-Allow-Origin", "*")
                w.Header().Set("Access-Control-Max-Age", "86400")
                statusCode = http.StatusOK
index 32174cb149cbf17631114fcdd8c4fd19b9fb70cc..6add8043e0f0e512aa9f4aa2033cd833547ea932 100644 (file)
@@ -45,7 +45,7 @@ func (s *UnitSuite) TestCORSPreflight(c *check.C) {
        c.Check(resp.Code, check.Equals, http.StatusOK)
        c.Check(resp.Body.String(), check.Equals, "")
        c.Check(resp.Header().Get("Access-Control-Allow-Origin"), check.Equals, "*")
-       c.Check(resp.Header().Get("Access-Control-Allow-Methods"), check.Equals, "GET, POST, OPTIONS, PROPFIND, PUT")
+       c.Check(resp.Header().Get("Access-Control-Allow-Methods"), check.Equals, "GET, MOVE, OPTIONS, POST, PROPFIND, PUT")
        c.Check(resp.Header().Get("Access-Control-Allow-Headers"), check.Equals, "Authorization, Content-Type, Range")
 
        // Check preflight for a disallowed request
index 87d9c47f1430e9a8c028ff35c0eb2b16e6772d82..4a9476dc990bf5ff50519a61e00872c2e62a5b66 100644 (file)
@@ -53,7 +53,10 @@ func (fs *webdavFS) RemoveAll(ctx context.Context, name string) error {
 }
 
 func (fs *webdavFS) Rename(ctx context.Context, oldName, newName string) error {
-       return errReadOnly
+       if fs.update == nil {
+               return errReadOnly
+       }
+       return fs.Rename(oldName, newName)
 }
 
 func (fs *webdavFS) Stat(ctx context.Context, name string) (os.FileInfo, error) {