From 2602fc8258edda3bad484d16223cbd21619dc8e1 Mon Sep 17 00:00:00 2001 From: "A.Unger" <zyxancf@gmail.com> Date: Thu, 13 Aug 2020 15:31:05 +0200 Subject: [PATCH 1/3] redo changes on ListPublicShares --- .../ocs/handlers/apps/sharing/shares/shares.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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..3693ba3479 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 @@ -1162,14 +1162,14 @@ func (h *Handler) listPublicShares(r *http.Request, filters []*link.ListPublicSh } statResponse, err := c.Stat(ctx, statRequest) - if err != nil { - return nil, err + if statResponse.Status.Code != rpc.Code_CODE_OK { + if statResponse.Status.Code == rpc.Code_CODE_NOT_FOUND { + // TODO share target was not found, we should not error here. + continue + } } sData := conversions.PublicShare2ShareData(share, r, h.publicURL) - if statResponse.Status.Code != rpc.Code_CODE_OK { - return nil, err - } sData.Name = share.DisplayName From a6da71c993797f4cfefe397ddee45264af599558 Mon Sep 17 00:00:00 2001 From: "A.Unger" <zyxancf@gmail.com> Date: Thu, 13 Aug 2020 15:45:11 +0200 Subject: [PATCH 2/3] add changelog --- changelog/unreleased/ignore-stray-public-shares.md | 5 +++++ 1 file changed, 5 insertions(+) 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 From 9bf8135c996733956b137461b95091b4497580cd Mon Sep 17 00:00:00 2001 From: "A.Unger" <zyxancf@gmail.com> Date: Thu, 13 Aug 2020 15:55:46 +0200 Subject: [PATCH 3/3] improve error handling --- .../owncloud/ocs/handlers/apps/sharing/shares/shares.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 3693ba3479..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 @@ -1162,11 +1162,15 @@ func (h *Handler) listPublicShares(r *http.Request, filters []*link.ListPublicSh } statResponse, err := c.Stat(ctx, statRequest) + if err != nil { + return nil, err + } if statResponse.Status.Code != rpc.Code_CODE_OK { if statResponse.Status.Code == rpc.Code_CODE_NOT_FOUND { - // TODO share target was not found, we should not error here. 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)