From ab0ed86ee66623c9e92b9cc7ef89c2f645a4fe6c Mon Sep 17 00:00:00 2001 From: Luizao Date: Wed, 8 Dec 2021 19:28:53 -0300 Subject: [PATCH] fixing resultPath on successful GCP upload to use fileName from bucket instead of local variable --- src/Duffer/GCSDuffer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Duffer/GCSDuffer.php b/src/Duffer/GCSDuffer.php index 5f7a743..2729a4e 100644 --- a/src/Duffer/GCSDuffer.php +++ b/src/Duffer/GCSDuffer.php @@ -62,10 +62,10 @@ public function upload() foreach ($this->filesToUpload as $fileToUpload) { try { $fileName = $fileToUpload->getName(); - $bucket->upload($fileToUpload->getBytes(), [ + $bucketObj = $bucket->upload($fileToUpload->getBytes(), [ 'name' => $fileName ]); - $fileToUpload->setResultPath(self::STORAGE_URI . $this->bucketName . '/' . $fileName); + $fileToUpload->setResultPath(self::STORAGE_URI . $this->bucketName . '/' . $bucketObj->name() ? $bucketObj->name() : $fileName); $fileToUpload->setStatus(FILE::FINISHED); } catch (\Exception $e) { $fileToUpload->setErrorMessage($e->getMessage());