mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 01:05:42 +00:00
Truncate local file in ScpClient.Download (#1729)
Similar to #1686 but for the local side of SCP: opening the file should use Create not OpenWrite. closes #648
This commit is contained in:
@@ -824,7 +824,7 @@ namespace Renci.SshNet
|
||||
fileInfo = new FileInfo(Path.Combine(currentDirectoryFullName, fileName));
|
||||
}
|
||||
|
||||
using (var output = fileInfo.OpenWrite())
|
||||
using (var output = fileInfo.Open(FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
InternalDownload(channel, input, output, fileName, length);
|
||||
}
|
||||
|
||||
@@ -679,7 +679,8 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
var fileInfo = new FileInfo(Path.GetTempFileName());
|
||||
// Create a local file larger than the remote file in order to test truncation.
|
||||
var fileInfo = new FileInfo(CreateTempFile(size + 64));
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user