X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/1bbdd9c70d0099e0bf46b3c1ac55e423e3406314..646e1d88d8aac461e0a13b6c0f1aa1b198e3659c:/src/common/webdav.ts diff --git a/src/common/webdav.ts b/src/common/webdav.ts index 8aea568a..a09e8fdd 100644 --- a/src/common/webdav.ts +++ b/src/common/webdav.ts @@ -28,18 +28,14 @@ export class WebDAV { data }) - upload = (url: string, path: string, files: File[], config: WebDAVRequestConfig = {}) => { - const fd = new FormData(); - fd.append('path', path); - files.forEach((f, idx) => { - fd.append(`file-${idx}`, f); - }); - - return this.request({ - ...config, url, - method: 'PUT', - data: fd - }); + upload = (url: string, files: File[], config: WebDAVRequestConfig = {}) => { + return Promise.all( + files.map(file => this.request({ + ...config, url, + method: 'PUT', + data: file + })) + ); } copy = (url: string, destination: string, config: WebDAVRequestConfig = {}) => @@ -66,7 +62,6 @@ export class WebDAV { return new Promise((resolve, reject) => { const r = this.createRequest(); r.open(config.method, this.defaults.baseURL + config.url); - const headers = { ...this.defaults.headers, ...config.headers }; Object .keys(headers) @@ -115,4 +110,4 @@ interface RequestConfig { headers?: { [key: string]: string }; data?: any; onUploadProgress?: (event: ProgressEvent) => void; -} +} \ No newline at end of file