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 1e25a9e0a54..1469f28367e 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 @@ -748,29 +748,36 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) { } func (h *Handler) listSharesWithOthers(w http.ResponseWriter, r *http.Request) { - shares := make([]*conversions.ShareData, 0) + userShares := make([]*conversions.ShareData, 0) + publicShares := make([]*conversions.ShareData, 0) + filters := []*collaboration.ListSharesRequest_Filter{} linkFilters := []*link.ListPublicSharesRequest_Filter{} - var err error + var e error + var status *rpc.Status // shared with others p := r.URL.Query().Get("path") if p != "" { // prefix the path with the owners home, because ocs share requests are relative to the home dir - filters, linkFilters, err = h.addFilters(w, r, h.homeNamespace) - if err != nil { + filters, linkFilters, e = h.addFilters(w, r, h.homeNamespace) + if e != nil { // result has been written as part of addFilters return } } - userShares, status, err := h.listUserShares(r, filters) - h.logProblems(status, err, "could not listUserShares") - - publicShares, status, err := h.listPublicShares(r, linkFilters) - h.logProblems(status, err, "could not listPublicShares") + shareTypes, err := strconv.Atoi(r.URL.Query().Get("share_types")) + if err != nil || shareTypes == int(conversions.ShareTypeUser) || shareTypes == int(conversions.ShareTypeGroup) { + userShares, status, e = h.listUserShares(r, filters) + h.logProblems(status, e, "could not listUserShares") + } + if err != nil || shareTypes == int(conversions.ShareTypePublicLink) { + publicShares, status, e = h.listPublicShares(r, linkFilters) + h.logProblems(status, e, "could not listPublicShares") + } - shares = append(shares, append(userShares, publicShares...)...) + shares := append(userShares, publicShares...) response.WriteOCSSuccess(w, r, shares) }