From d2b176fee8fc983d241511c8a2b3f456e9938bb2 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 18 Nov 2025 16:06:57 +0100 Subject: [PATCH 1/2] fix: encode s3 metadata as base64 if needed Signed-off-by: Robin Appelman --- lib/private/Files/ObjectStore/S3.php | 3 +++ lib/private/Files/ObjectStore/S3ObjectTrait.php | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/private/Files/ObjectStore/S3.php b/lib/private/Files/ObjectStore/S3.php index 72e1751e23d3c..e92346e4ccc01 100644 --- a/lib/private/Files/ObjectStore/S3.php +++ b/lib/private/Files/ObjectStore/S3.php @@ -100,6 +100,9 @@ private function parseS3Metadata(array $metadata): array { $result = []; foreach ($metadata as $key => $value) { if (str_starts_with($key, 'x-amz-meta-')) { + if (str_starts_with($value, 'base64:')) { + $value = base64_decode(substr($value, 7)); + } $result[substr($key, strlen('x-amz-meta-'))] = $value; } } diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 9362609fa5ad2..f47a01dab18b3 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -82,7 +82,11 @@ public function readObject($urn) { private function buildS3Metadata(array $metadata): array { $result = []; foreach ($metadata as $key => $value) { - $result['x-amz-meta-' . $key] = $value; + if (mb_check_encoding($value, 'ASCII')) { + $result['x-amz-meta-' . $key] = $value; + } else { + $result['x-amz-meta-' . $key] = 'base64:' . base64_encode($value); + } } return $result; } From a65a7cdae0e8746be4e43ce89cfc8c74f44030b8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 18 Nov 2025 16:07:29 +0100 Subject: [PATCH 2/2] Revert "fix(ObjectStoreStorage): Encode original-path in writeStream by @frabe1579" This reverts commit 4b4b39e7ec6d8cc33effc8a0923eafde10aefa41. Signed-off-by: Robin Appelman