Skip to content

Commit 8ab5e9e

Browse files
authored
Merge pull request #47 from Konnng/fix/remove-dir
Fixing folder 550 delete action
2 parents 9039859 + dc0ecf6 commit 8ab5e9e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/syncProvider.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class FTPSyncProvider implements ISyncProvider {
5050

5151
/**
5252
* Converts a file path (ex: "folder/otherfolder/file.txt") to an array of folder and a file path
53-
* @param fullPath
53+
* @param fullPath
5454
*/
5555
private getFileBreadcrumbs(fullPath: string): IFilePath {
5656
// todo see if this regex will work for nonstandard folder names
@@ -110,7 +110,7 @@ export class FTPSyncProvider implements ISyncProvider {
110110
}
111111
catch (e: any) {
112112
// this error is common when a file was deleted on the server directly
113-
if (e.code === ErrorCode.FileNotFoundOrNoAccess) {
113+
if (e?.code === ErrorCode.FileNotFoundOrNoAccess) {
114114
this.logger.standard("File not found or you don't have access to the file - skipping...");
115115
}
116116
else {
@@ -128,7 +128,17 @@ export class FTPSyncProvider implements ISyncProvider {
128128
this.logger.all(`removing folder "${absoluteFolderPath}"`);
129129

130130
if (this.dryRun === false) {
131-
await retryRequest(this.logger, async () => await this.client.removeDir(absoluteFolderPath));
131+
try {
132+
await retryRequest(this.logger, async () => await this.client.removeDir(absoluteFolderPath));
133+
}
134+
catch (e: any) {
135+
if (e?.code === ErrorCode.FileNotFoundOrNoAccess) {
136+
this.logger.standard("Directory not found or you don't have access to the file - skipping...");
137+
}
138+
else {
139+
throw e;
140+
}
141+
}
132142
}
133143

134144
this.logger.verbose(` completed`);

0 commit comments

Comments
 (0)