diff --git a/changelog/unreleased/fix-public-share-paths.md b/changelog/unreleased/fix-public-share-paths.md new file mode 100644 index 0000000000..07a6b2faf2 --- /dev/null +++ b/changelog/unreleased/fix-public-share-paths.md @@ -0,0 +1,3 @@ +Bugfix: Fix public link paths for file shares + +https://github.com/cs3org/reva/pull/2297 \ No newline at end of file diff --git a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go index 25a1eb246b..148e86eb02 100644 --- a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go +++ b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go @@ -154,7 +154,12 @@ func (s *service) translatePublicRefToCS3Ref(ctx context.Context, ref *provider. return nil, "", nil, st, nil } - cs3Ref := &provider.Reference{Path: path.Join("/", shareInfo.Path, relativePath)} + p := shareInfo.Path + if shareInfo.Type != provider.ResourceType_RESOURCE_TYPE_FILE { + p = path.Join("/", shareInfo.Path, relativePath) + } + cs3Ref := &provider.Reference{Path: p} + log.Debug(). Interface("sourceRef", ref). Interface("cs3Ref", cs3Ref). diff --git a/internal/http/services/owncloud/ocdav/publicfile.go b/internal/http/services/owncloud/ocdav/publicfile.go index b369f6650b..2d4ce28595 100644 --- a/internal/http/services/owncloud/ocdav/publicfile.go +++ b/internal/http/services/owncloud/ocdav/publicfile.go @@ -55,7 +55,6 @@ func (h *PublicFileHandler) Handler(s *svc) http.Handler { return } - r.URL.Path = path.Base(r.URL.Path) switch r.Method { case MethodPropfind: s.handlePropfindOnToken(w, r, h.namespace, false) @@ -121,9 +120,6 @@ func (s *svc) adjustResourcePathInURL(w http.ResponseWriter, r *http.Request) bo return false } - // adjust path in request URL to point at the parent - r.URL.Path = path.Dir(r.URL.Path) - return true }