From 345aaf8fff934b6abbaf29f0616175a35029d52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 17 Sep 2020 10:18:06 +0200 Subject: [PATCH] fix ocis move (#1177) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/fix-oci-move.md | 5 +++++ pkg/storage/fs/ocis/tree.go | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/fix-oci-move.md diff --git a/changelog/unreleased/fix-oci-move.md b/changelog/unreleased/fix-oci-move.md new file mode 100644 index 0000000000..517f7499e6 --- /dev/null +++ b/changelog/unreleased/fix-oci-move.md @@ -0,0 +1,5 @@ +Bugfix: Fix ocis move + +When renaming a file we updating the name attribute on the wrong node, causing the path construction to use the wrong name. This fixes the litmus move_coll test. + +https://github.com/cs3org/reva/pull/1177 \ No newline at end of file diff --git a/pkg/storage/fs/ocis/tree.go b/pkg/storage/fs/ocis/tree.go index 553df7b330..beb9837a25 100644 --- a/pkg/storage/fs/ocis/tree.go +++ b/pkg/storage/fs/ocis/tree.go @@ -141,7 +141,8 @@ func (t *Tree) Move(ctx context.Context, oldNode *Node, newNode *Node) (err erro return errors.Wrap(err, "ocisfs: could not rename child") } - tgtPath := filepath.Join(t.pw.Root, "nodes", newNode.ID) + // the new node id might be different, so we need to use the old nodes id + tgtPath := filepath.Join(t.pw.Root, "nodes", oldNode.ID) // update name attribute if err := xattr.Set(tgtPath, "user.ocis.name", []byte(newNode.Name)); err != nil {