...
This commit is contained in:
		| @@ -162,6 +162,31 @@ class WebDAVClient { | ||||
|         return true; | ||||
|     } | ||||
|      | ||||
|     async includeFile(path) { | ||||
|         try { | ||||
|             // Parse path: "collection:path/to/file" or "path/to/file" | ||||
|             let targetCollection = this.currentCollection; | ||||
|             let targetPath = path; | ||||
|              | ||||
|             if (path.includes(':')) { | ||||
|                 [targetCollection, targetPath] = path.split(':'); | ||||
|             } | ||||
|              | ||||
|             // Temporarily switch collection | ||||
|             const originalCollection = this.currentCollection; | ||||
|             this.currentCollection = targetCollection; | ||||
|              | ||||
|             const content = await this.get(targetPath); | ||||
|              | ||||
|             // Restore collection | ||||
|             this.currentCollection = originalCollection; | ||||
|              | ||||
|             return content; | ||||
|         } catch (error) { | ||||
|             throw new Error(`Cannot include file "${path}": ${error.message}`); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     parseMultiStatus(xml) { | ||||
|         const parser = new DOMParser(); | ||||
|         const doc = parser.parseFromString(xml, 'text/xml'); | ||||
| @@ -231,6 +256,7 @@ class WebDAVClient { | ||||
|             } else { | ||||
|                 root.push(node); | ||||
|             } | ||||
|              | ||||
|         }); | ||||
|          | ||||
|         return root; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user