Skip to content

Commit

Permalink
Style fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
marko1616 committed Aug 21, 2024
1 parent fdda602 commit b0dcc5f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
6 changes: 3 additions & 3 deletions tabby-core/src/api/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface MessageBoxResult {

export abstract class FileTransfer {
abstract getName (): string
abstract getRelativePath (): string
abstract getRelativePath (): string | null
abstract getMode (): number
abstract getSize (): number
abstract close (): void
Expand Down Expand Up @@ -204,8 +204,8 @@ export class HTMLFileUpload extends FileUpload {
return this.file.name
}

getRelativePath (): string {
return ''
getRelativePath (): null {
return null
}

getMode (): number {
Expand Down
17 changes: 9 additions & 8 deletions tabby-electron/src/services/platform.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,17 @@ export class ElectronPlatformService extends PlatformService {
}

if(options.directory) {
let allFiles: string[] = []
let relativePaths: string[] = []
let fileInfos: { fullPath: string, relativePath: string }[] = []
for (const folderPath of paths) {
const files = await this.getAllFiles(folderPath)
allFiles = allFiles.concat(files)
relativePaths = relativePaths.concat(files.map(file => path.posix.join(path.basename(folderPath), path.posix.relative(folderPath, file))))
fileInfos = fileInfos.concat(files.map(file => ({
fullPath: file,
relativePath: path.posix.join(path.basename(folderPath), path.posix.relative(folderPath, file))

Check failure on line 234 in tabby-electron/src/services/platform.service.ts

View workflow job for this annotation

GitHub Actions / Lint

Missing trailing comma
})))
}

return Promise.all(allFiles.map(async (p, index) => {
const transfer = new ElectronFileUpload(p, this.electron, relativePaths[index])
return Promise.all(fileInfos.map(async (fileInfo) => {
const transfer = new ElectronFileUpload(fileInfo.fullPath, this.electron, fileInfo.relativePath)
await wrapPromise(this.zone, transfer.open())
this.fileTransferStarted.next(transfer)
return transfer
Expand Down Expand Up @@ -363,8 +364,8 @@ class ElectronFileDownload extends FileDownload {
return path.basename(this.filePath)
}

getRelativePath (): string {
return ''
getRelativePath (): null {
return null
}

getMode (): number {
Expand Down
18 changes: 11 additions & 7 deletions tabby-ssh/src/components/sftpPanel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,25 +187,29 @@ export class SFTPPanelComponent {

async uploadOneWithFolder (transfer: FileUpload): Promise<void> {
const savedPath = this.path
const RelativePath = transfer.getRelativePath()
if (RelativePath == null){

Check failure on line 191 in tabby-ssh/src/components/sftpPanel.component.ts

View workflow job for this annotation

GitHub Actions / Lint

Missing space before opening brace
return
}

try {
await this.sftp.stat(path.join(this.path, transfer.getRelativePath()))
await this.sftp.stat(path.join(this.path, RelativePath))
} catch (e) {
if (e instanceof Error && e.message.includes('No such file')) {
let accumPath = ''
for (const pathParts of path.posix.dirname(transfer.getRelativePath()).split(path.posix.sep)) {
for (const pathParts of path.posix.dirname(RelativePath).split(path.posix.sep)) {
accumPath = path.posix.join(accumPath, pathParts)
this.sftp.mkdir(path.join(this.path, accumPath)).then(() => {
this.notifications.notice('The directory was created successfully')
}).catch(() => {
try {
await this.sftp.mkdir(path.join(this.path, accumPath))
} catch (e) {

Check failure on line 204 in tabby-ssh/src/components/sftpPanel.component.ts

View workflow job for this annotation

GitHub Actions / Lint

'e' is already declared in the upper scope on line 197 column 18
// Intentionally ignoring errors from making duplicate dirs.
})
}
}
} else {
throw e
}
}
await this.sftp.upload(path.join(this.path, transfer.getRelativePath()), transfer)
await this.sftp.upload(path.join(this.path, RelativePath), transfer)
if (this.path === savedPath) {
await this.navigate(this.path)
}
Expand Down
4 changes: 2 additions & 2 deletions tabby-web/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ class HTMLFileDownload extends FileDownload {
return this.name
}

getRelativePath (): string {
return ''
getRelativePath (): null {
return null
}

getMode (): number {
Expand Down

0 comments on commit b0dcc5f

Please sign in to comment.