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 {