mirror of
https://github.com/SamKirkland/FTP-Deploy-Action.git
synced 2025-08-15 06:25:05 +00:00
Merge 6b90cbdaf1b545fc01e063c4d59b76aee9169337 into 8e83cea8672e3fbcbb9fdafff34debf6ae4c5f65
This commit is contained in:
commit
c4e59264f1
11
dist/index.js
vendored
11
dist/index.js
vendored
@ -4632,7 +4632,8 @@ class Client {
|
||||
* @example client.removeDir("/") // Remove everything.
|
||||
*/
|
||||
async removeDir(remoteDirPath) {
|
||||
return this._exitAtCurrentDirectory(async () => {
|
||||
try {
|
||||
return await this._exitAtCurrentDirectory(async () => {
|
||||
await this.cd(remoteDirPath);
|
||||
// Get the absolute path of the target because remoteDirPath might be a relative path, even `../` is possible.
|
||||
const absoluteDirPath = await this.pwd();
|
||||
@ -4643,6 +4644,14 @@ class Client {
|
||||
await this.removeEmptyDir(absoluteDirPath);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
// Safely ignore if the folder doesn't exist
|
||||
if (err.code === 550 || err.message.includes("No such file or directory") || err.message.includes("File not found")) {
|
||||
console.warn(`Warning: Folder "${remoteDirPath}" not found, skipping deletion.`);
|
||||
return;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Remove all files and directories in the working directory without removing
|
||||
|
Loading…
x
Reference in New Issue
Block a user