From f9580544973d90841d912c900d904957cdc0d939 Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Wed, 3 Jul 2024 10:33:55 +0200 Subject: [PATCH] fix: quotes placement in content-disposition header Fixes the placement of the quotes in the dav `Content-Disposition` header. The misplacement caused an issue where certain browsers would decode the quotes and falsely prepend them to the filename. --- .../unreleased/fix-quotes-in-content-disposition-headers.md | 6 ++++++ internal/http/services/owncloud/ocdav/net/builders.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/fix-quotes-in-content-disposition-headers.md diff --git a/changelog/unreleased/fix-quotes-in-content-disposition-headers.md b/changelog/unreleased/fix-quotes-in-content-disposition-headers.md new file mode 100644 index 00000000000..364f78ea343 --- /dev/null +++ b/changelog/unreleased/fix-quotes-in-content-disposition-headers.md @@ -0,0 +1,6 @@ +Bugfix: Quotes in dav Content-Disposition header + +We've fixed the placement of the quotes in the dav `Content-Disposition` header. The misplacement caused an issue where certain browsers would decode the quotes and falsely prepend them to the filename. + +https://github.com/cs3org/reva/pull/4748 +https://github.com/owncloud/web/issues/11031 diff --git a/internal/http/services/owncloud/ocdav/net/builders.go b/internal/http/services/owncloud/ocdav/net/builders.go index be7b8fdeecf..2977e2ee0d5 100644 --- a/internal/http/services/owncloud/ocdav/net/builders.go +++ b/internal/http/services/owncloud/ocdav/net/builders.go @@ -27,7 +27,7 @@ import ( // ContentDispositionAttachment builds a ContentDisposition Attachment header with various filename encodings func ContentDispositionAttachment(filename string) string { - return "attachment; filename*=UTF-8''\"" + filename + "\"; filename=\"" + filename + "\"" + return "attachment; filename*=\"UTF-8''" + filename + "\"; filename=\"" + filename + "\"" } // RFC1123Z formats a CS3 Timestamp to be used in HTTP headers like Last-Modified