From caa06f1c9e4bfb33e5f4e1757266d80d38efdb88 Mon Sep 17 00:00:00 2001 From: Sven Petersen <97380444+svenpet90@users.noreply.github.com> Date: Sun, 20 Feb 2022 20:05:43 +0100 Subject: [PATCH] Fixed missing usage of $propertiesToExtract in StorageDriver::getFileInfoByIdentifier() (#33) Fixed missing usage of $propertiesToExtract in StorageDriver::getFileInfoByIdentifier() closes #32 --- Classes/Driver/StorageDriver.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Classes/Driver/StorageDriver.php b/Classes/Driver/StorageDriver.php index dd974da..2f5ddd6 100644 --- a/Classes/Driver/StorageDriver.php +++ b/Classes/Driver/StorageDriver.php @@ -694,10 +694,9 @@ public function getFileInfoByIdentifier($fileIdentifier, array $propertiesToExtr $properties = $blob->getProperties(); $fileInfo['size'] = $properties->getContentLength(); $fileInfo['mimetype'] = $properties->getContentType(); - } - return array_merge($fileInfo, [ + $fileInfo = array_merge($fileInfo, [ 'identifier' => $fileIdentifier, 'name' => basename(rtrim($fileIdentifier, '/')), 'storage' => $this->storageUid, @@ -705,6 +704,14 @@ public function getFileInfoByIdentifier($fileIdentifier, array $propertiesToExtr 'folder_hash' => $this->hashIdentifier($this->getParentFolderIdentifierOfIdentifier($fileIdentifier)), 'mtime' => $properties->getLastModified()->format('U'), ]); + + $fileInfoToExtract = []; + + foreach ($propertiesToExtract as $propertyName) { + $fileInfoToExtract[$propertyName] = $fileInfo[$propertyName]; + } + + return $fileInfoToExtract ?: $fileInfo; } /**