diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go index dd636f4b54..7d9840ecde 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/public.go @@ -295,9 +295,14 @@ func (h *Handler) isPublicShare(r *http.Request, oid string) (*link.PublicShare, }, }, }) - if err != nil { - logger.Err(err) + switch { + case err != nil: + log.Err(err).Send() return nil, false + case psRes.Status.Code == rpc.Code_CODE_OK: + fallthrough + case psRes.Status.Code == rpc.Code_CODE_NOT_FOUND: + log.Debug().Str("message", psRes.GetStatus().GetMessage()).Str("code", psRes.GetStatus().GetCode().String()).Msg("isPublicShare received unexpected status") } return psRes.GetShare(), psRes.GetShare() != nil diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/user.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/user.go index 65247a9443..f47e1d5115 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/user.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/user.go @@ -132,10 +132,10 @@ func (h *Handler) createUserShare(w http.ResponseWriter, r *http.Request, statIn } func (h *Handler) isUserShare(r *http.Request, oid string) (*collaboration.Share, bool) { - logger := appctx.GetLogger(r.Context()) + log := appctx.GetLogger(r.Context()) client, err := pool.GetGatewayServiceClient(h.gatewayAddr) if err != nil { - logger.Err(err) + log.Err(err).Send() } getShareRes, err := client.GetShare(r.Context(), &collaboration.GetShareRequest{ @@ -147,9 +147,14 @@ func (h *Handler) isUserShare(r *http.Request, oid string) (*collaboration.Share }, }, }) - if err != nil { - logger.Err(err) + switch { + case err != nil: + log.Err(err).Send() return nil, false + case getShareRes.Status.Code == rpc.Code_CODE_OK: + fallthrough + case getShareRes.Status.Code == rpc.Code_CODE_NOT_FOUND: + log.Debug().Str("message", getShareRes.GetStatus().GetMessage()).Str("code", getShareRes.GetStatus().GetCode().String()).Msg("isUserShare received unexpected status") } return getShareRes.GetShare(), getShareRes.GetShare() != nil @@ -172,9 +177,14 @@ func (h *Handler) isFederatedShare(r *http.Request, shareID string) bool { }, }, }) - if err != nil { + switch { + case err != nil: log.Err(err).Send() return false + case getShareRes.Status.Code == rpc.Code_CODE_OK: + fallthrough + case getShareRes.Status.Code == rpc.Code_CODE_NOT_FOUND: + log.Debug().Str("message", getShareRes.GetStatus().GetMessage()).Str("code", getShareRes.GetStatus().GetCode().String()).Msg("isFederatedShare received unexpected status") } return getShareRes.GetShare() != nil @@ -247,9 +257,14 @@ func (h *Handler) isFederatedReceivedShare(r *http.Request, shareID string) bool }, }, }) - if err != nil { + switch { + case err != nil: log.Err(err).Send() return false + case getShareRes.Status.Code == rpc.Code_CODE_OK: + fallthrough + case getShareRes.Status.Code == rpc.Code_CODE_NOT_FOUND: + log.Debug().Str("message", getShareRes.GetStatus().GetMessage()).Str("code", getShareRes.GetStatus().GetCode().String()).Msg("isFederatedReceivedShare received unexpected status") } return getShareRes.GetShare() != nil