From 8dbe60621de10d36befb3a3dda859dab31ede5f2 Mon Sep 17 00:00:00 2001 From: Ra'Jiska Date: Thu, 6 Oct 2022 14:41:37 +0800 Subject: [PATCH] Fix GCS Upload Metadata Mistake --- lib/Data/GoogleCloudStorage.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Data/GoogleCloudStorage.php b/lib/Data/GoogleCloudStorage.php index 1f11a6e..e876325 100644 --- a/lib/Data/GoogleCloudStorage.php +++ b/lib/Data/GoogleCloudStorage.php @@ -112,13 +112,18 @@ class GoogleCloudStorage extends AbstractData */ private function _upload($key, $payload) { + $metadata = array_key_exists('meta', $payload) ? $payload['meta'] : array(); + unset($metadata['attachment'], $metadata['attachmentname'], $metadata['salt']); + foreach ($metadata as $k => $v) { + $metadata[$k] = strval($v); + } try { $data = array( 'name' => $key, 'chunkSize' => 262144, 'metadata' => array( 'content-type' => 'application/json', - 'metadata' => $payload, + 'metadata' => $metadata, ), ); if (!self::$_uniformacl) {