From 7c7612e079b8cb80e5e276db64ff7aad7cdd1ae5 Mon Sep 17 00:00:00 2001 From: Gianmaria Del Monte <39946305+gmgigi96@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:47:48 +0200 Subject: [PATCH] Fix accessing an OCM-shared resource containing spaces (#4171) --- changelog/unreleased/fix-spaces-ocm-basic-auth.md | 6 ++++++ internal/http/services/owncloud/ocdav/dav.go | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelog/unreleased/fix-spaces-ocm-basic-auth.md diff --git a/changelog/unreleased/fix-spaces-ocm-basic-auth.md b/changelog/unreleased/fix-spaces-ocm-basic-auth.md new file mode 100644 index 0000000000..e73ba2da74 --- /dev/null +++ b/changelog/unreleased/fix-spaces-ocm-basic-auth.md @@ -0,0 +1,6 @@ +Bugfix: Fix accessing an OCM-shared resource containing spaces + +Fixes the access of a resource OCM-shared containing spaces, that +previously was failing with a `NotFound` error. + +https://github.com/cs3org/reva/pull/4171 diff --git a/internal/http/services/owncloud/ocdav/dav.go b/internal/http/services/owncloud/ocdav/dav.go index ca42666023..65ba52e31a 100644 --- a/internal/http/services/owncloud/ocdav/dav.go +++ b/internal/http/services/owncloud/ocdav/dav.go @@ -21,8 +21,8 @@ package ocdav import ( "context" "net/http" - "net/url" "path" + "path/filepath" "strings" gatewayv1beta1 "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" @@ -195,7 +195,7 @@ func (h *DavHandler) Handler(s *svc) http.Handler { if ok { // OCM 1.0 token = username - r.URL.Path, _ = url.JoinPath("/", token, r.URL.Path) + r.URL.Path = filepath.Join("/", token, r.URL.Path) ctx = context.WithValue(ctx, ctxOCM10, true) } else { token, _ = router.ShiftPath(r.URL.Path)