}
async files(uuid: string) {
- const request = await this.webdavClient.propfind(`/c=${uuid}`);
+ const request = await this.webdavClient.propfind(`c=${uuid}`);
if (request.responseXML != null) {
const filesTree = parseFilesResponse(request.responseXML);
return mapTreeValues(this.extendFileURL)(filesTree);
async deleteFiles(collectionUuid: string, filePaths: string[]) {
for (const path of filePaths) {
- await this.webdavClient.delete(`/c=${collectionUuid}${path}`);
+ await this.webdavClient.delete(`c=${collectionUuid}${path}`);
}
}
}
}
+ moveFile(collectionUuid: string, oldPath: string, newPath: string) {
+ return this.webdavClient.move(
+ `c=${collectionUuid}${oldPath}`,
+ `c=${collectionUuid}${encodeURI(newPath)}`
+ );
+ }
+
private extendFileURL = (file: CollectionDirectory | CollectionFile) => ({
...file,
url: this.webdavClient.defaults.baseURL + file.url + '?api_token=' + this.authService.getApiToken()
})
private async uploadFile(collectionUuid: string, file: File, fileId: number, onProgress: UploadProgress = () => { return; }) {
- const fileURL = `/c=${collectionUuid}/${file.name}`;
+ const fileURL = `c=${collectionUuid}/${file.name}`;
const fileContent = await fileToArrayBuffer(file);
const requestConfig = {
headers: {