Fix GCS Upload Metadata Mistake

This commit is contained in:
Ra'Jiska 2022-10-06 14:41:37 +08:00
parent 8dded4e8e4
commit 8dbe60621d

View file

@ -112,13 +112,18 @@ class GoogleCloudStorage extends AbstractData
*/ */
private function _upload($key, $payload) 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 { try {
$data = array( $data = array(
'name' => $key, 'name' => $key,
'chunkSize' => 262144, 'chunkSize' => 262144,
'metadata' => array( 'metadata' => array(
'content-type' => 'application/json', 'content-type' => 'application/json',
'metadata' => $payload, 'metadata' => $metadata,
), ),
); );
if (!self::$_uniformacl) { if (!self::$_uniformacl) {