mirror of
https://github.com/winscp/winscp.git
synced 2026-10-24 02:28:55 +03:00
Bug 1922: Do not use a transfer via temporary file for files that would exceed system length limit with the temporary extension
https://winscp.net/tracker/1922 Source commit: f9016b757e70c4d7479abe4cc9b3ff1ad2878ed3
This commit is contained in:
@@ -775,15 +775,24 @@ int __fastcall TCopyParamType::LocalFileAttrs(const TRights & Rights) const
|
||||
return Result;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TCopyParamType::AllowResume(__int64 Size) const
|
||||
bool __fastcall TCopyParamType::AllowResume(__int64 Size, const UnicodeString & FileName) const
|
||||
{
|
||||
switch (ResumeSupport)
|
||||
bool Result;
|
||||
if (FileName.Length() + UnicodeString(PARTIAL_EXT).Length() > 255) // it's a different limit than MAX_PATH
|
||||
{
|
||||
case rsOn: return true;
|
||||
case rsOff: return false;
|
||||
case rsSmart: return (Size >= ResumeThreshold);
|
||||
default: DebugFail(); return false;
|
||||
Result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (ResumeSupport)
|
||||
{
|
||||
case rsOn: Result = true; break;
|
||||
case rsOff: Result = false; break;
|
||||
case rsSmart: Result = (Size >= ResumeThreshold); break;
|
||||
default: DebugFail(); Result = false; break;
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
bool __fastcall TCopyParamType::AllowAnyTransfer() const
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
TRights __fastcall RemoteFileRights(int Attrs) const;
|
||||
bool __fastcall UseAsciiTransfer(UnicodeString FileName, TOperationSide Side,
|
||||
const TFileMasks::TParams & Params) const;
|
||||
bool __fastcall AllowResume(__int64 Size) const;
|
||||
bool __fastcall AllowResume(__int64 Size, const UnicodeString & FileName) const;
|
||||
bool __fastcall ResumeTransfer(UnicodeString FileName) const;
|
||||
UnicodeString __fastcall ValidLocalFileName(UnicodeString FileName) const;
|
||||
UnicodeString __fastcall ValidLocalPath(UnicodeString Path) const;
|
||||
|
||||
@@ -3669,9 +3669,10 @@ bool __fastcall TFTPFileSystem::HandleAsynchRequestOverwrite(
|
||||
}
|
||||
}
|
||||
|
||||
bool AllowResume = UserData.CopyParam->AllowResume(FileParams.SourceSize, UnicodeString());
|
||||
bool AutoResume = UserData.AutoResume;
|
||||
if (ConfirmOverwrite(SourceFullFileName, TargetFileName, OverwriteMode, OperationProgress,
|
||||
(NoFileParams ? NULL : &FileParams), UserData.CopyParam, UserData.Params,
|
||||
UserData.AutoResume && UserData.CopyParam->AllowResume(FileParams.SourceSize)))
|
||||
(NoFileParams ? NULL : &FileParams), UserData.CopyParam, UserData.Params, AutoResume))
|
||||
{
|
||||
switch (OverwriteMode)
|
||||
{
|
||||
|
||||
@@ -4502,7 +4502,7 @@ void __fastcall TSFTPFileSystem::Source(
|
||||
// should we check for interrupted transfer?
|
||||
ResumeAllowed =
|
||||
!OperationProgress->AsciiTransfer &&
|
||||
CopyParam->AllowResume(OperationProgress->LocalSize) &&
|
||||
CopyParam->AllowResume(OperationProgress->LocalSize, DestFileName) &&
|
||||
IsCapable(fcRename) &&
|
||||
!FTerminal->IsEncryptingFiles() &&
|
||||
(CopyParam->OnTransferIn == NULL);
|
||||
@@ -5260,7 +5260,7 @@ void __fastcall TSFTPFileSystem::Sink(
|
||||
bool ResumeAllowed =
|
||||
FLAGCLEAR(Params, cpTemporary) &&
|
||||
!OperationProgress->AsciiTransfer &&
|
||||
CopyParam->AllowResume(OperationProgress->TransferSize) &&
|
||||
CopyParam->AllowResume(OperationProgress->TransferSize, DestFileName) &&
|
||||
!FTerminal->IsEncryptingFiles() &&
|
||||
(CopyParam->OnTransferOut == NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user