14873: Fixes JSON custom types.
[arvados.git] / services / keep-web / webdav.go
index 3e62b19bbe296f35a514543121d3b29111133db1..f9b753869a70e17bbf2d5b36f7596a6b0589b287 100644 (file)
@@ -50,7 +50,7 @@ func (fs *webdavFS) makeparents(name string) {
        if !fs.writing {
                return
        }
-       dir, name := path.Split(name)
+       dir, _ := path.Split(name)
        if dir == "" || dir == "/" {
                return
        }
@@ -100,6 +100,11 @@ func (fs *webdavFS) Rename(ctx context.Context, oldName, newName string) error {
        if !fs.writing {
                return errReadOnly
        }
+       if strings.HasSuffix(oldName, "/") {
+               // WebDAV "MOVE foo/ bar/" means rename foo to bar.
+               oldName = oldName[:len(oldName)-1]
+               newName = strings.TrimSuffix(newName, "/")
+       }
        fs.makeparents(newName)
        return fs.collfs.Rename(oldName, newName)
 }