14345: Handle "MOVE foo/ bar/" requests.
[arvados.git] / services / keep-web / webdav.go
index 5b23c9c5fa9f10bffec55d48e6950fd0ac76d639..f9b753869a70e17bbf2d5b36f7596a6b0589b287 100644 (file)
@@ -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)
 }