Safely list directory, create if not exists
(path: string)
| 680 | |
| 681 | /** Safely list directory, create if not exists */ |
| 682 | async safeReadDir(path: string): Promise<DavResource[]> { |
| 683 | const collectionPath = toCollectionPath(path); |
| 684 | try { |
| 685 | return await this.propfind(collectionPath); |
| 686 | } catch (e: unknown) { |
| 687 | const err = e as { message?: string }; |
| 688 | if (err.message?.includes("404")) { |
| 689 | await this.ensureDirectory(collectionPath); |
| 690 | return []; |
| 691 | } |
| 692 | throw e; |
| 693 | } |
| 694 | } |
| 695 | } |
| 696 | |
| 697 | /** |
no test coverage detected