Browse Source

Bug 1770: Files larger than 0.5 GB are never uploaded in ascii/text mode with SCP protocol as it would fail anyway due to memory issues

https://winscp.net/tracker/1770

Source commit: 5556d5c5dc139de1e67954f7466ad174ce5a11f3
Martin Prikryl 6 years ago
parent
commit
1fea8fe90e
1 changed files with 9 additions and 1 deletions
  1. 9 1
      source/core/ScpFileSystem.cpp

+ 9 - 1
source/core/ScpFileSystem.cpp

@@ -1757,7 +1757,15 @@ void __fastcall TSCPFileSystem::SCPSource(const UnicodeString FileName,
     OperationProgress->SetTransferSize(OperationProgress->LocalSize);
     OperationProgress->SetTransferringFile(false);
 
-    FTerminal->SelectSourceTransferMode(Handle, CopyParam);
+    if (Handle.Size > 512*1024*1024)
+    {
+      OperationProgress->SetAsciiTransfer(false);
+      FTerminal->LogEvent(FORMAT(L"Binary transfer mode selected as the file is too large (%s) to be uploaded in Ascii mode using SCP protocol.", (IntToStr(Handle.Size))));
+    }
+    else
+    {
+      FTerminal->SelectSourceTransferMode(Handle, CopyParam);
+    }
 
     TUploadSessionAction Action(FTerminal->ActionLog);
     Action.FileName(ExpandUNCFileName(FileName));