sftp: fixed upload renaming - fixes #4383, fixes #4455

This commit is contained in:
Eugene Pankov 2021-08-22 20:23:51 +02:00
parent 43e3277c0d
commit 0a0d94ec91
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
2 changed files with 4 additions and 2 deletions

View File

@ -96,7 +96,7 @@ export class SFTPPanelComponent {
}
async uploadOne (transfer: FileUpload): Promise<void> {
this.sftp.upload(path.join(this.path, transfer.getName()), transfer)
await this.sftp.upload(path.join(this.path, transfer.getName()), transfer)
const savedPath = this.path
if (this.path === savedPath) {
await this.navigate(this.path)

View File

@ -146,7 +146,9 @@ export class SFTPSession {
await handle.write(chunk)
}
handle.close()
await this.unlink(path)
try {
await this.unlink(path)
} catch { }
await this.rename(tempPath, path)
transfer.close()
} catch (e) {