diff --git a/changelog/unreleased/fix-content-disposition.md b/changelog/unreleased/fix-content-disposition.md new file mode 100644 index 0000000000..dcd887266d --- /dev/null +++ b/changelog/unreleased/fix-content-disposition.md @@ -0,0 +1,4 @@ +Bugfix: Fix content disposition header for public links files + +https://github.com/cs3org/reva/pull/2303 +https://github.com/cs3org/reva/pull/2297 \ No newline at end of file diff --git a/changelog/unreleased/fix-public-share-paths.md b/changelog/unreleased/fix-public-share-paths.md deleted file mode 100644 index 07a6b2faf2..0000000000 --- a/changelog/unreleased/fix-public-share-paths.md +++ /dev/null @@ -1,3 +0,0 @@ -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 c6ec4e983e..4a8185dc47 100644 --- a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go +++ b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go @@ -163,12 +163,7 @@ func (s *service) translatePublicRefToCS3Ref(ctx context.Context, ref *provider. return nil, "", nil, st, nil } - p := shareInfo.Path - if shareInfo.Type != provider.ResourceType_RESOURCE_TYPE_FILE { - p = path.Join("/", shareInfo.Path, relativePath) - } - cs3Ref := &provider.Reference{Path: p} - + cs3Ref := &provider.Reference{Path: path.Join("/", shareInfo.Path, relativePath)} log.Debug(). Interface("sourceRef", ref). Interface("cs3Ref", cs3Ref). diff --git a/internal/http/services/owncloud/ocdav/get.go b/internal/http/services/owncloud/ocdav/get.go index 6bd08c52da..cefc4da7df 100644 --- a/internal/http/services/owncloud/ocdav/get.go +++ b/internal/http/services/owncloud/ocdav/get.go @@ -124,7 +124,7 @@ func (s *svc) handleGet(ctx context.Context, w http.ResponseWriter, r *http.Requ w.Header().Set(HeaderContentType, info.MimeType) w.Header().Set(HeaderContentDisposistion, "attachment; filename*=UTF-8''"+ - path.Base(info.Path)+"; filename=\""+path.Base(info.Path)+"\"") + path.Base(r.RequestURI)+"; filename=\""+path.Base(r.RequestURI)+"\"") w.Header().Set(HeaderETag, info.Etag) w.Header().Set(HeaderOCFileID, wrapResourceID(info.Id)) w.Header().Set(HeaderOCETag, info.Etag) diff --git a/internal/http/services/owncloud/ocdav/publicfile.go b/internal/http/services/owncloud/ocdav/publicfile.go index 2d4ce28595..b369f6650b 100644 --- a/internal/http/services/owncloud/ocdav/publicfile.go +++ b/internal/http/services/owncloud/ocdav/publicfile.go @@ -55,6 +55,7 @@ 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) @@ -120,6 +121,9 @@ 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 }