From c521d693a431ffd5a46436a5d5989e34c53d15b4 Mon Sep 17 00:00:00 2001 From: Kent Delante Date: Wed, 8 Jul 2026 21:02:23 +0800 Subject: [PATCH] fix(s3): trim multiple spaces to single space in original path header Signed-off-by: Kent Delante The spec defines that x-amz-meta-original-path header needs spaces to be trimmed and multiple spaces need to be converted to a single space. This is to comply with the spec and fix it for some storage hosts that return a SignatureDoesNotMatch error when not done. --- lib/private/Files/ObjectStore/ObjectStoreStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 8c9634e8ef290..c98b5b1caa13c 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -470,7 +470,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int { $metadata = [ 'mimetype' => $mimetype, 'original-storage' => $this->getId(), - 'original-path' => $path, + 'original-path' => preg_replace('/\s+/', ' ', $path) ?? $path, ]; if ($size) { $metadata['size'] = $size;