From ac655d65383998597cf0b2c6c0c17c3c5bd6de6f Mon Sep 17 00:00:00 2001 From: Joris Vaesen Date: Tue, 27 Feb 2018 17:37:58 +0100 Subject: [PATCH 1/2] Auto set contentType when not specified --- src/GoogleStorageAdapter.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/GoogleStorageAdapter.php b/src/GoogleStorageAdapter.php index faff062..f80185e 100644 --- a/src/GoogleStorageAdapter.php +++ b/src/GoogleStorageAdapter.php @@ -170,6 +170,10 @@ protected function upload($path, $contents, Config $config) $options = $this->getOptionsFromConfig($config); $options['name'] = $path; + + if (!isset($options['metadata']['contentType']) { + $options['metadata']['contentType'] = mime_content_type($path); + } $object = $this->bucket->upload($contents, $options); From e4958e5fa3ca7ba61abad1fc35f412a184a3dc30 Mon Sep 17 00:00:00 2001 From: Joris Vaesen Date: Tue, 27 Feb 2018 17:40:21 +0100 Subject: [PATCH 2/2] fix typo --- src/GoogleStorageAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GoogleStorageAdapter.php b/src/GoogleStorageAdapter.php index f80185e..719dd8b 100644 --- a/src/GoogleStorageAdapter.php +++ b/src/GoogleStorageAdapter.php @@ -171,7 +171,7 @@ protected function upload($path, $contents, Config $config) $options = $this->getOptionsFromConfig($config); $options['name'] = $path; - if (!isset($options['metadata']['contentType']) { + if (!isset($options['metadata']['contentType'])) { $options['metadata']['contentType'] = mime_content_type($path); }