From 85061732fa13108a969c19cf59d2cb96ce7c702c Mon Sep 17 00:00:00 2001 From: Leonardo Berbert Date: Thu, 5 Feb 2026 12:02:43 -0300 Subject: [PATCH] Add SFTP context menu download for files (#10971) --- locale/pt-BR.po | 3 +-- .../src/components/sftpPanel.component.ts | 20 +++++++++++++++++++ tabby-ssh/src/sftpContextMenu.ts | 7 +++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/locale/pt-BR.po b/locale/pt-BR.po index 168b50af..101d95d5 100644 --- a/locale/pt-BR.po +++ b/locale/pt-BR.po @@ -710,7 +710,7 @@ msgstr "Abaixo" #: locale/tmp-html/tabby-settings/src/components/configSyncSettingsTab.component.html:43 msgid "Download" -msgstr "Transferir" +msgstr "Download" #: locale/tmp-html/tabby-terminal/src/components/terminalSettingsTab.component.html:23 msgid "Draw bold text in bright colors" @@ -2571,4 +2571,3 @@ msgstr "Diminuir zoom" msgctxt "[Dynamic] port forwarding" msgid "id.port-forwarding.dynamic" msgstr "DinĂ¢mico" - diff --git a/tabby-ssh/src/components/sftpPanel.component.ts b/tabby-ssh/src/components/sftpPanel.component.ts index aff00014..3bd7f892 100644 --- a/tabby-ssh/src/components/sftpPanel.component.ts +++ b/tabby-ssh/src/components/sftpPanel.component.ts @@ -170,6 +170,26 @@ export class SFTPPanelComponent { } } + async downloadItem (item: SFTPFile): Promise { + if (item.isDirectory) { + await this.downloadFolder(item) + return + } + + if (item.isSymlink) { + const target = path.resolve(this.path, await this.sftp.readlink(item.fullPath)) + const stat = await this.sftp.stat(target) + if (stat.isDirectory) { + await this.downloadFolder(item) + return + } + await this.download(item.fullPath, stat.mode, stat.size) + return + } + + await this.download(item.fullPath, item.mode, item.size) + } + async openCreateDirectoryModal (): Promise { const modal = this.ngbModal.open(SFTPCreateDirectoryModalComponent) const directoryName = await modal.result.catch(() => null) diff --git a/tabby-ssh/src/sftpContextMenu.ts b/tabby-ssh/src/sftpContextMenu.ts index 72ad17e7..0a9e05c3 100644 --- a/tabby-ssh/src/sftpContextMenu.ts +++ b/tabby-ssh/src/sftpContextMenu.ts @@ -39,6 +39,13 @@ export class CommonSFTPContextMenu extends SFTPContextMenuItemProvider { }) } + if (!item.isDirectory) { + items.push({ + click: () => panel.downloadItem(item), + label: this.translate.instant('Download'), + }) + } + items.push({ click: async () => { if ((await this.platform.showMessageBox({