Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/private/Files/ObjectStore/S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
6 changes: 5 additions & 1 deletion lib/private/Files/ObjectStore/S3ObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading