aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/ObjectStore/S3.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-03-28 17:44:02 +0100
committerRobin Appelman <robin@icewind.nl>2025-03-31 15:10:58 +0200
commit8aae332622587e7d3fc53c2a08be2f6fa61f9070 (patch)
treece10b54081aa68ffcf16d46978e43a3e8d7aaf75 /lib/private/Files/ObjectStore/S3.php
parent94114b99f74cbc8a77532e880042781f0edfcc0a (diff)
downloadnextcloud-server-object-store-filename.tar.gz
nextcloud-server-object-store-filename.zip
feat: store original storage id and path in object store metadataobject-store-filename
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/ObjectStore/S3.php')
-rw-r--r--lib/private/Files/ObjectStore/S3.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/Files/ObjectStore/S3.php b/lib/private/Files/ObjectStore/S3.php
index e970fb6ac14..23c061db174 100644
--- a/lib/private/Files/ObjectStore/S3.php
+++ b/lib/private/Files/ObjectStore/S3.php
@@ -95,6 +95,16 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload, IObjectStoreMetaD
]);
}
+ private function parseS3Metadata(array $metadata): array {
+ $result = [];
+ foreach ($metadata as $key => $value) {
+ if (str_starts_with($key, 'x-amz-meta-')) {
+ $result[substr($key, strlen('x-amz-meta-'))] = $value;
+ }
+ }
+ return $result;
+ }
+
public function getObjectMetaData(string $urn): array {
$object = $this->getConnection()->headObject([
'Bucket' => $this->bucket,
@@ -104,7 +114,7 @@ class S3 implements IObjectStore, IObjectStoreMultiPartUpload, IObjectStoreMetaD
'mtime' => $object['LastModified'],
'etag' => trim($object['ETag'], '"'),
'size' => (int)($object['Size'] ?? $object['ContentLength']),
- ];
+ ] + $this->parseS3Metadata($object['Metadata'] ?? []);
}
public function listObjects(string $prefix = ''): \Iterator {