Skip to content

Commit

Permalink
🐛 忽略webdav创建目录错误 #213
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Aug 25, 2023
1 parent cc5e22d commit 890076a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/filesystem/webdav/webdav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,18 @@ export default class WebDAVFileSystem implements FileSystem {
);
}

createDir(path: string): Promise<void> {
return this.client.createDirectory(joinPath(this.basePath, path));
async createDir(path: string): Promise<void> {
try {
return Promise.resolve(
await this.client.createDirectory(joinPath(this.basePath, path))
);
} catch (e: any) {
// 如果是405错误,则忽略
if (e.message.includes("405")) {
return Promise.resolve();
}
return Promise.reject(e);
}
}

async delete(path: string): Promise<void> {
Expand Down

0 comments on commit 890076a

Please sign in to comment.