From 3b1b0835a1c36b46e24502500effd3d08aa0d181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Thu, 17 Sep 2020 09:47:56 +0200 Subject: [PATCH] fix ocis move 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 {