mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-04 22:21:23 +12:00
add call to GetReply after using OpenRead or OpenWrite according to FluentFTP documentation
This commit is contained in:
parent
a796eba0fc
commit
07e3bf3311
|
@ -231,10 +231,7 @@ public bool UploadData(Stream localStream, string remotePath)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (Stream remoteStream = client.OpenWrite(remotePath))
|
return UploadData2(localStream, remotePath);
|
||||||
{
|
|
||||||
return TransferData(localStream, remoteStream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (FtpCommandException e)
|
catch (FtpCommandException e)
|
||||||
{
|
{
|
||||||
|
@ -243,10 +240,7 @@ public bool UploadData(Stream localStream, string remotePath)
|
||||||
{
|
{
|
||||||
CreateMultiDirectory(URLHelpers.GetDirectoryPath(remotePath));
|
CreateMultiDirectory(URLHelpers.GetDirectoryPath(remotePath));
|
||||||
|
|
||||||
using (Stream remoteStream = client.OpenWrite(remotePath))
|
return UploadData2(localStream, remotePath);
|
||||||
{
|
|
||||||
return TransferData(localStream, remoteStream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -256,6 +250,17 @@ public bool UploadData(Stream localStream, string remotePath)
|
||||||
return false;
|
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)
|
public void UploadData(byte[] data, string remotePath)
|
||||||
{
|
{
|
||||||
using (MemoryStream stream = new MemoryStream(data, false))
|
using (MemoryStream stream = new MemoryStream(data, false))
|
||||||
|
@ -322,6 +327,7 @@ public void DownloadFile(string remotePath, Stream localStream)
|
||||||
{
|
{
|
||||||
TransferData(remoteStream, localStream);
|
TransferData(remoteStream, localStream);
|
||||||
}
|
}
|
||||||
|
client.GetReply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue