Skip to content

Commit

Permalink
[BUGFIX] Append slash to folder identifiers
Browse files Browse the repository at this point in the history
This patch fixes the problem that fetching a folder via API
and using that to upload a file put the file into the wrong folder:

    $folder = $storage->getFolder('myfolder');
    $storage->addFile('/tmp/file.txt', $folder, 'file.txt');
    //created "/myfolderfile.txt" instead of "/myfolder/file.txt"

TYPO3's own
`AbstractHierarchicalFilesystemDriver::canonicalizeAndCheckFolderIdentifier`
appends slashes,
and our `createFolder()` already returned identifiers with slashes at the end.

Resolves: andersundsehr#146
  • Loading branch information
cweiske committed Jan 23, 2024
1 parent 9f8b710 commit 236b00d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/Driver/AmazonS3Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ public function getFolderInfoByIdentifier($folderIdentifier)
$this->normalizeIdentifier($folderIdentifier);

return [
'identifier' => $folderIdentifier,
'identifier' => rtrim($folderIdentifier, '/') . '/',
'name' => basename(rtrim($folderIdentifier, '/')),
'storage' => $this->storageUid,
'mtime' => null,
Expand Down Expand Up @@ -1440,7 +1440,7 @@ protected function getFolder($identifier)
return $this->getRootLevelFolder();
}
$this->normalizeIdentifier($identifier);
return new Folder($this->getStorage(), $identifier, basename(rtrim($identifier, '/')));
return new Folder($this->getStorage(), rtrim($identifier, '/') . '/', basename(rtrim($identifier, '/')));
}

/**
Expand Down

0 comments on commit 236b00d

Please sign in to comment.