We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4a83b4b commit 794efb8Copy full SHA for 794efb8
1 file changed
src/Client.ts
@@ -604,10 +604,13 @@ export class Client {
604
async removeDir(remoteDirPath: string): Promise<void> {
605
return this._exitAtCurrentDirectory(async () => {
606
await this.cd(remoteDirPath)
607
+ // Get the absolute path of the target because remoteDirPath might be a relative path, even `../` is possible.
608
+ const absoluteDirPath = await this.pwd()
609
await this.clearWorkingDir()
- if (remoteDirPath !== "/") {
610
+ const dirIsRoot = absoluteDirPath === "/"
611
+ if (!dirIsRoot) {
612
await this.cdup()
- await this.removeEmptyDir(remoteDirPath)
613
+ await this.removeEmptyDir(absoluteDirPath)
614
}
615
})
616
0 commit comments