mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
fixed #747: SFTP handle error when disconnected while uploading
This commit is contained in:
parent
83c730b2d6
commit
c112b69649
1 changed files with 6 additions and 0 deletions
|
@ -232,6 +232,8 @@ private bool UploadStream(Stream stream, string remotePath)
|
|||
}
|
||||
catch (SftpPathNotFoundException)
|
||||
{
|
||||
// Happens when directory not exist, create directory and retry uploading
|
||||
|
||||
CreateDirectory(URLHelpers.GetDirectoryPath(remotePath));
|
||||
|
||||
using (SftpFileStream sftpStream = client.OpenWrite(remotePath))
|
||||
|
@ -239,6 +241,10 @@ private bool UploadStream(Stream stream, string remotePath)
|
|||
return TransferData(stream, sftpStream);
|
||||
}
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
// Happens when disconnected while uploading
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue