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

Bug 2016: Failure when entering directory that contains file with a slash in its name

https://winscp.net/tracker/2016

Source commit: 3cab6dcd0bebd66d62bc8aa4ef37867b454b3d51
This commit is contained in:
Martin Prikryl
2021-08-13 13:44:34 +00:00
parent 42a30f9e94
commit a4f5fdd521
6 changed files with 69 additions and 42 deletions

View File

@@ -1009,8 +1009,6 @@ void __fastcall TSCPFileSystem::ReadDirectory(TRemoteFileList * FileList)
Params);
}
TRemoteFile * File;
// If output is not empty, we have successfully got file listing,
// otherwise there was an error, in case it was "permission denied"
// we try to get at least parent directory (see "else" statement below)
@@ -1036,8 +1034,11 @@ void __fastcall TSCPFileSystem::ReadDirectory(TRemoteFileList * FileList)
UnicodeString OutputLine = OutputCopy->Strings[Index];
if (!OutputLine.IsEmpty())
{
File = CreateRemoteFile(OutputCopy->Strings[Index]);
FileList->AddFile(File);
std::unique_ptr<TRemoteFile> File(CreateRemoteFile(OutputCopy->Strings[Index]));
if (FTerminal->IsValidFile(File.get()))
{
FileList->AddFile(File.release());
}
}
}
}
@@ -1053,6 +1054,7 @@ void __fastcall TSCPFileSystem::ReadDirectory(TRemoteFileList * FileList)
{
// Empty file list -> probably "permission denied", we
// at least get link to parent directory ("..")
TRemoteFile * File;
FTerminal->ReadFile(
UnixIncludeTrailingBackslash(FTerminal->FFiles->Directory) +
PARENTDIRECTORY, File);