Merge remote-tracking branch 'origin' into sftp

This commit is contained in:
Thomas Peterson
2022-03-30 19:00:42 +02:00
10 changed files with 36 additions and 8 deletions

View File

@@ -113,8 +113,11 @@ export class SFTPPanelComponent {
const modal = this.ngbModal.open(SFTPCreateDirectoryModalComponent)
const directoryName = await modal.result
if (directoryName !== '') {
this.sftp.mkdir(path.join(this.path, directoryName)).finally(() => {
this.sftp.mkdir(path.join(this.path, directoryName)).then(() => {
this.notifications.notice('The directory was created successfully')
this.navigate(path.join(this.path, directoryName))
}).catch(() => {
this.notifications.error('The directory could not be created')
})
}
}
@@ -125,7 +128,11 @@ export class SFTPPanelComponent {
}
async uploadOne (transfer: FileUpload): Promise<void> {
const savedPath = this.path
await this.sftp.upload(path.join(this.path, transfer.getName()), transfer)
if (this.path === savedPath) {
await this.navigate(this.path)
}
}
async download (itemPath: string, mode: number, size: number): Promise<void> {

View File

@@ -12,7 +12,6 @@ import type { FileEntry, Stats } from 'ssh2-streams'
export interface SFTPFile {
name: string
fullPath: string
directory: string
isDirectory: boolean
isSymlink: boolean
mode: number
@@ -104,7 +103,6 @@ export class SFTPSession {
const stats = await wrapPromise(this.zone, promisify<Stats>(f => this.sftp.stat(p, f))())
return {
name: posixPath.basename(p),
directory: posixPath.dirname(p),
fullPath: p,
isDirectory: stats.isDirectory(),
isSymlink: stats.isSymbolicLink(),
@@ -188,7 +186,6 @@ export class SFTPSession {
return {
fullPath: p,
name: posixPath.basename(p),
directory: posixPath.dirname(p),
isDirectory: (entry.attrs.mode & C.S_IFDIR) === C.S_IFDIR,
isSymlink: (entry.attrs.mode & C.S_IFLNK) === C.S_IFLNK,
mode: entry.attrs.mode,