From dec87e1111644e8c18c0ecf5500ac1a8291fe071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 22 Nov 2021 14:01:42 +0000 Subject: [PATCH 1/3] make content disposition reflect request base path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- internal/http/services/owncloud/ocdav/get.go | 2 +- internal/http/services/owncloud/ocdav/publicfile.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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 } From eb82c25e4312d0ebe03d508f288c612e42641d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 22 Nov 2021 14:05:52 +0000 Subject: [PATCH 2/3] Revert "Fix public link paths for file shares (#2297)" This reverts commit 29826a363ae1fe1406944af327ef4cd948f9664b. --- changelog/unreleased/fix-public-share-paths.md | 3 --- .../publicstorageprovider/publicstorageprovider.go | 7 +------ 2 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 changelog/unreleased/fix-public-share-paths.md 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 148e86eb02..25a1eb246b 100644 --- a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go +++ b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go @@ -154,12 +154,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). From 2cb9d7c2eb5b1dfd825cfbe9b1e3f2810bff333e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 22 Nov 2021 14:18:18 +0000 Subject: [PATCH 3/3] Add content disposition fix changelog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/fix-content-disposition.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelog/unreleased/fix-content-disposition.md 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