Skip to content

Commit 7657f63

Browse files
committed
avoid extra stat call and const
Signed-off-by: jkoberg <[email protected]>
1 parent 99c0c11 commit 7657f63

File tree

1 file changed

+3
-11
lines changed
  • internal/http/services/owncloud/ocs/handlers/apps/sharing/shares

1 file changed

+3
-11
lines changed

internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go

+3-11
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ import (
3333
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/conversions"
3434
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/response"
3535
"github.com/cs3org/reva/v2/pkg/appctx"
36+
"github.com/cs3org/reva/v2/pkg/publicshare"
3637
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
3738
"github.com/pkg/errors"
3839
)
3940

4041
// QuicklinkName is the reserved name for a quicklink.
4142
// Creating (or updating) a link with (to) the same name will be blocked by the server
42-
var QuicklinkName = "Quicklink"
43+
const QuicklinkName = "Quicklink"
4344

4445
func (h *Handler) createPublicLinkShare(w http.ResponseWriter, r *http.Request, statInfo *provider.ResourceInfo) (*link.PublicShare, *ocsError) {
4546
ctx := r.Context()
@@ -76,16 +77,7 @@ func (h *Handler) createPublicLinkShare(w http.ResponseWriter, r *http.Request,
7677

7778
// check if a quicklink should be created
7879
if quick {
79-
_, f, err := h.addFilters(w, r, &provider.Reference{ResourceId: statInfo.Id})
80-
if err != nil {
81-
log.Error().Err(err).Msg("could not add filters")
82-
return nil, &ocsError{
83-
Code: response.MetaServerError.StatusCode,
84-
Message: "could not add filters",
85-
Error: err,
86-
}
87-
}
88-
80+
f := []*link.ListPublicSharesRequest_Filter{publicshare.ResourceIDFilter(statInfo.Id)}
8981
req := link.ListPublicSharesRequest{Filters: f}
9082
res, err := c.ListPublicShares(ctx, &req)
9183
if err != nil {

0 commit comments

Comments
 (0)