From 3a449c88838e3f66e1e6170c606650bc65a6a6f4 Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Wed, 10 Jul 2024 09:55:20 +0200 Subject: [PATCH] fix: blanks in dav Content-Disposition header Fixes the encoding of blanks in the dav `Content-Disposition` header. This is a regression caused by #4748. --- .../unreleased/fix-blanks-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-blanks-in-content-disposition-headers.md diff --git a/changelog/unreleased/fix-blanks-in-content-disposition-headers.md b/changelog/unreleased/fix-blanks-in-content-disposition-headers.md new file mode 100644 index 00000000000..0e4e0c82ecc --- /dev/null +++ b/changelog/unreleased/fix-blanks-in-content-disposition-headers.md @@ -0,0 +1,6 @@ +Bugfix: Blanks in dav Content-Disposition header + +We've fixed the encoding of blanks in the dav `Content-Disposition` header. + +https://github.com/cs3org/reva/pull/4762 +https://github.com/owncloud/web/issues/11169 diff --git a/internal/http/services/owncloud/ocdav/net/builders.go b/internal/http/services/owncloud/ocdav/net/builders.go index f9bd903b43d..727c59c03f6 100644 --- a/internal/http/services/owncloud/ocdav/net/builders.go +++ b/internal/http/services/owncloud/ocdav/net/builders.go @@ -28,7 +28,7 @@ import ( // ContentDispositionAttachment builds a ContentDisposition Attachment header with various filename encodings func ContentDispositionAttachment(filename string) string { - return "attachment; filename*=UTF-8''" + url.QueryEscape(filename) + "; filename=\"" + filename + "\"" + return "attachment; filename*=UTF-8''" + url.PathEscape(filename) + "; filename=\"" + filename + "\"" } // RFC1123Z formats a CS3 Timestamp to be used in HTTP headers like Last-Modified