mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-02 18:26:27 +13:00
add call to GetReply after using OpenRead or OpenWrite according to FluentFTP documentation
This commit is contained in:
parent
a796eba0fc
commit
07e3bf3311
1 changed files with 14 additions and 8 deletions
|
@ -231,10 +231,7 @@ public bool UploadData(Stream localStream, string remotePath)
|
|||
{
|
||||
try
|
||||
{
|
||||
using (Stream remoteStream = client.OpenWrite(remotePath))
|
||||
{
|
||||
return TransferData(localStream, remoteStream);
|
||||
}
|
||||
return UploadData2(localStream, remotePath);
|
||||
}
|
||||
catch (FtpCommandException e)
|
||||
{
|
||||
|
@ -243,10 +240,7 @@ public bool UploadData(Stream localStream, string remotePath)
|
|||
{
|
||||
CreateMultiDirectory(URLHelpers.GetDirectoryPath(remotePath));
|
||||
|
||||
using (Stream remoteStream = client.OpenWrite(remotePath))
|
||||
{
|
||||
return TransferData(localStream, remoteStream);
|
||||
}
|
||||
return UploadData2(localStream, remotePath);
|
||||
}
|
||||
|
||||
throw e;
|
||||
|
@ -256,6 +250,17 @@ public bool UploadData(Stream localStream, string remotePath)
|
|||
return false;
|
||||
}
|
||||
|
||||
private bool UploadData2(Stream localStream, string remotePath)
|
||||
{
|
||||
bool result;
|
||||
using (Stream remoteStream = client.OpenWrite(remotePath))
|
||||
{
|
||||
result = TransferData(localStream, remoteStream);
|
||||
}
|
||||
FtpReply ftpReply = client.GetReply();
|
||||
return result && ftpReply.Success;
|
||||
}
|
||||
|
||||
public void UploadData(byte[] data, string remotePath)
|
||||
{
|
||||
using (MemoryStream stream = new MemoryStream(data, false))
|
||||
|
@ -322,6 +327,7 @@ public void DownloadFile(string remotePath, Stream localStream)
|
|||
{
|
||||
TransferData(remoteStream, localStream);
|
||||
}
|
||||
client.GetReply();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue