From 507eea90524915c2fad18e6204039392a99321f6 Mon Sep 17 00:00:00 2001 From: David Christofas Date: Mon, 30 Nov 2020 16:28:53 +0100 Subject: [PATCH] read owner information in ReadRecycleItem (#1348) we have to read the owner information in ReadRecycleItem because the lookup would return the origin node path instead of the deleted node path Fixes https://github.com/owncloud/ocis/issues/551 --- changelog/unreleased/fix-ocis-storage-purge.md | 5 +++++ pkg/storage/fs/ocis/node.go | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 changelog/unreleased/fix-ocis-storage-purge.md diff --git a/changelog/unreleased/fix-ocis-storage-purge.md b/changelog/unreleased/fix-ocis-storage-purge.md new file mode 100644 index 00000000000..63de22af7f9 --- /dev/null +++ b/changelog/unreleased/fix-ocis-storage-purge.md @@ -0,0 +1,5 @@ +Bugfix: Fix purging deleted files with the ocis storage + +The ocis storage could load the owner information of a deleted file. This caused the storage to not be able to purge deleted files. + +https://github.com/owncloud/ocis/issues/551 diff --git a/pkg/storage/fs/ocis/node.go b/pkg/storage/fs/ocis/node.go index 2a6d32ed678..fe71edef965 100644 --- a/pkg/storage/fs/ocis/node.go +++ b/pkg/storage/fs/ocis/node.go @@ -124,6 +124,18 @@ func ReadRecycleItem(ctx context.Context, lu *Lookup, key string) (n *Node, tras } else { return } + // lookup ownerId in extended attributes + if attrBytes, err = xattr.Get(deletedNodePath, ownerIDAttr); err == nil { + n.ownerID = string(attrBytes) + } else { + return + } + // lookup ownerIdp in extended attributes + if attrBytes, err = xattr.Get(deletedNodePath, ownerIDPAttr); err == nil { + n.ownerIDP = string(attrBytes) + } else { + return + } // get origin node origin = "/"