mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-04 14:04:56 +00:00
fixed multiple sftp uploads - fixes #4001
This commit is contained in:
@@ -91,18 +91,14 @@ export class SFTPPanelComponent {
|
||||
|
||||
async upload (): Promise<void> {
|
||||
const transfers = await this.platform.startUpload({ multiple: true })
|
||||
const savedPath = this.path
|
||||
for (const transfer of transfers) {
|
||||
this.uploadOne(transfer).then(() => {
|
||||
if (this.path === savedPath) {
|
||||
this.navigate(this.path)
|
||||
}
|
||||
})
|
||||
this.uploadOne(transfer)
|
||||
}
|
||||
}
|
||||
|
||||
async uploadOne (transfer: FileUpload): Promise<void> {
|
||||
const itemPath = path.join(this.path, transfer.getName())
|
||||
const savedPath = this.path
|
||||
try {
|
||||
const handle = await this.sftp.open(itemPath, 'w')
|
||||
while (true) {
|
||||
@@ -114,6 +110,9 @@ export class SFTPPanelComponent {
|
||||
}
|
||||
handle.close()
|
||||
transfer.close()
|
||||
if (this.path === savedPath) {
|
||||
this.navigate(this.path)
|
||||
}
|
||||
} catch (e) {
|
||||
transfer.cancel()
|
||||
throw e
|
||||
|
Reference in New Issue
Block a user