Tiny fix.

This commit is contained in:
marko1616 2024-08-21 14:33:11 +08:00
parent 89dd0773ee
commit f630b53e0a
3 changed files with 8 additions and 7 deletions

View file

@ -48,7 +48,7 @@ export class ElectronPlatformService extends PlatformService {
})
}
async getAllFiles (dir: string): string[] {
async getAllFiles (dir: string): Promise<string[]> {
let files: string[] = []
const items = await fs.readdir(dir, { withFileTypes: true })
for (const item of items) {

View file

@ -192,16 +192,17 @@ export class SFTPPanelComponent {
await this.sftp.stat(path.join(this.path, transfer.getRelativePath()))
} catch (e) {
if (e instanceof Error && e.message.includes('No such file')) {
let accumPath = ""
let accumPath = ''
for (const pathParts of path.posix.dirname(transfer.getRelativePath()).split(path.posix.sep)) {
accumPath = path.posix.join(accumPath,pathParts)
accumPath = path.posix.join(accumPath, pathParts)
this.sftp.mkdir(path.join(this.path, accumPath)).then(() => {
this.notifications.notice('The directory was created successfully')
}).catch(() => {})
}).catch(() => {
// Intentionally ignoring errors from making duplicate dirs.
})
}
} else {
console.log("THROW HERE")
throw e;
throw e
}
}
await this.sftp.upload(path.join(this.path, transfer.getRelativePath()), transfer)

View file

@ -160,7 +160,7 @@ class HTMLFileDownload extends FileDownload {
}
getRelativePath (): string {
return ""
return ''
}
getMode (): number {