From baea1c67fb87702e9ce057c9d1300889543c5733 Mon Sep 17 00:00:00 2001 From: Alex Unger Date: Thu, 13 Aug 2020 17:20:25 +0200 Subject: [PATCH] Ignore Stray Public Shares (#1090) --- changelog/unreleased/ignore-stray-public-shares.md | 5 +++++ .../ocs/handlers/apps/sharing/shares/shares.go | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 changelog/unreleased/ignore-stray-public-shares.md diff --git a/changelog/unreleased/ignore-stray-public-shares.md b/changelog/unreleased/ignore-stray-public-shares.md new file mode 100644 index 0000000000..d0427567c1 --- /dev/null +++ b/changelog/unreleased/ignore-stray-public-shares.md @@ -0,0 +1,5 @@ +Bugfix: Ensure ignoring public stray shares + +When using the json public shares manager, it can be the case we found a share with a resource_id that no longer exists. + +https://github.com/cs3org/reva/pull/1090 \ No newline at end of file diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index 236e84f29b..ecefdb6ed8 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -1165,12 +1165,16 @@ func (h *Handler) listPublicShares(r *http.Request, filters []*link.ListPublicSh if err != nil { return nil, err } - - sData := conversions.PublicShare2ShareData(share, r, h.publicURL) if statResponse.Status.Code != rpc.Code_CODE_OK { - return nil, err + if statResponse.Status.Code == rpc.Code_CODE_NOT_FOUND { + continue + } + + return nil, errors.New(fmt.Sprintf("could not stat share target: %v, code: %v", share.ResourceId, statResponse.Status)) } + sData := conversions.PublicShare2ShareData(share, r, h.publicURL) + sData.Name = share.DisplayName if h.addFileInfo(ctx, sData, statResponse.Info) != nil {