1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Bug 1958: Failure when S3 bucket contains a subfolder with an empty name

https://winscp.net/tracker/1958

Source commit: b819b4ecb31616bffbbb4392debdd2cc11637d7f
This commit is contained in:
Martin Prikryl
2021-03-11 09:22:30 +00:00
parent 590c699a30
commit 3bb78c2893

View File

@@ -937,12 +937,13 @@ S3Status TS3FileSystem::LibS3ListBucketCallback(
for (int Index = 0; Index < CommonPrefixesCount; Index++)
{
UnicodeString CommonPrefix = StrFromS3(CommonPrefixes[Index]);
// Reported only by one user, but should do no harm.
if (CommonPrefix != L"/")
UnicodeString FileName = UnixExtractFileName(UnixExcludeTrailingBackslash(CommonPrefix));
// Have seen prefixes like "/" or "path/subpath//"
if (!FileName.IsEmpty())
{
std::unique_ptr<TRemoteFile> File(new TRemoteFile(NULL));
File->Terminal = Data.FileSystem->FTerminal;
File->FileName = UnixExtractFileName(UnixExcludeTrailingBackslash(CommonPrefix));
File->FileName = FileName;
File->Type = FILETYPE_DIRECTORY;
File->ModificationFmt = mfNone;
Data.FileList->AddFile(File.release());