Different methods in AmazonS3Driver return folder identifiers differently:
AmazonS3Driver::createFolder returns identifiers with a slash at the end: folder/
AmazonS3Driver::getFolder returns identifiers without a slash: foldername.
AmazonS3Driver::getFolderInfoByIdentifier returns identifiers without a slash: foldername.
This leads to the problem that creating a new file via addFile($localFilePath, $targetFolderIdentifier, $newFileName) will not put the file within the folder, but in the parent folder:
addFile('/tmp/foo', 'folder', 'filename.txt') creates /folderfilename.txt instead of folder/filename.txt.
Some methods already handle folder identifiers without slash and with slashes:
fileExistsInFolder
folderExistsInFolder
getFolderInFolder
getFileInFolder
createFile
createFolder
Other methods do not add slashes:
addFile
moveFileWithinStorage
copyFileWithinStorage
moveFolderWithinStorage
copyFolderWithinStorage
The question is now if folder identifiers should always have a slash at the end or not.
The decision to that question determines what needs to be done to solve the bugs.
AbstractHierarchicalFilesystemDriver::canonicalizeAndCheckFolderIdentifier appends a slash when missing, so I guess that folders should always have a slash at the end.
Different methods in
AmazonS3Driver
return folder identifiers differently:AmazonS3Driver::createFolder
returns identifiers with a slash at the end:folder/
AmazonS3Driver::getFolder
returns identifiers without a slash:foldername
.AmazonS3Driver::getFolderInfoByIdentifier
returns identifiers without a slash:foldername
.This leads to the problem that creating a new file via
addFile($localFilePath, $targetFolderIdentifier, $newFileName)
will not put the file within the folder, but in the parent folder:addFile('/tmp/foo', 'folder', 'filename.txt')
creates/folderfilename.txt
instead offolder/filename.txt
.Some methods already handle folder identifiers without slash and with slashes:
Other methods do not add slashes:
The question is now if folder identifiers should always have a slash at the end or not. The decision to that question determines what needs to be done to solve the bugs.