From b59945fc84c26422892a53ee00d5b51838f385c3 Mon Sep 17 00:00:00 2001 From: Mathias Brodala Date: Wed, 13 Oct 2021 17:06:02 +0200 Subject: [PATCH] [BUGFIX] Support nested file storages Fetch files from their storage using their local path instead of the full file identifier which may contain the base path of the storage. Fixes #42 --- Classes/Resource/RemoteResourceCollection.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Classes/Resource/RemoteResourceCollection.php b/Classes/Resource/RemoteResourceCollection.php index ea6c9c4..38dfc85 100644 --- a/Classes/Resource/RemoteResourceCollection.php +++ b/Classes/Resource/RemoteResourceCollection.php @@ -150,7 +150,7 @@ protected function fileCanBeReProcessed($fileIdentifier, $filePath) $localPath = $filePath; $storage = $this->resourceFactory->getStorageObject(0, [], $localPath); if ($storage->getUid() !== 0) { - static::$fileIdentifierCache[$fileIdentifier] = $this->getFileObjectFromStorage($storage, $fileIdentifier); + static::$fileIdentifierCache[$fileIdentifier] = $this->getFileObjectFromStorage($storage, $localPath); } } @@ -160,16 +160,16 @@ protected function fileCanBeReProcessed($fileIdentifier, $filePath) /** * @param ResourceStorage $storage - * @param string $fileIdentifier + * @param string $localPath * @return FileInterface|null */ - protected function getFileObjectFromStorage(ResourceStorage $storage, string $fileIdentifier) + protected function getFileObjectFromStorage(ResourceStorage $storage, string $localPath) { $fileObject = null; - if (!$storage->isWithinProcessingFolder($fileIdentifier)) { + if (!$storage->isWithinProcessingFolder($localPath)) { try { - $fileObject = $this->resourceFactory->getFileObjectByStorageAndIdentifier($storage->getUid(), $fileIdentifier); + $fileObject = $this->resourceFactory->getFileObjectByStorageAndIdentifier($storage->getUid(), $localPath); } catch (\InvalidArgumentException $e) { return null; } @@ -185,7 +185,7 @@ protected function getFileObjectFromStorage(ResourceStorage $storage, string $fi ), $expressionBuilder->eq( 'identifier', - $queryBuilder->createNamedParameter($fileIdentifier, \PDO::PARAM_STR) + $queryBuilder->createNamedParameter($localPath, \PDO::PARAM_STR) ) ) ->execute()