diff --git a/apps/files/src/mixins.js b/apps/files/src/mixins.js index bc03e6b75d8..30b9626479c 100644 --- a/apps/files/src/mixins.js +++ b/apps/files/src/mixins.js @@ -447,9 +447,22 @@ export default { // FIXME: this might break if relativePath is not the currentFolder // and is a mount point that has no chunk support if (this.browserSupportsChunked && this.currentFolder.isChunkedUploadSupported) { + let chunkSize = this.configuration.uploadChunkSize + if (this.capabilities.files.tus_support.max_chunk_size > 0) { + if ( + chunkSize === null || + chunkSize === 0 || + chunkSize > this.capabilities.files.tus_support.max_chunk_size + ) { + chunkSize = this.capabilities.files.tus_support.max_chunk_size + } + } + console.log('tus_support: ', this.capabilities.files.tus_support) + console.log('Using chunk size: ', chunkSize) promise = this.uploadQueue.add(() => { return this.uploadChunkedFile(file, pathUtil.dirname(relativePath), { - chunkSize: this.configuration.uploadChunkSize, + chunkSize: chunkSize, + overridePatchMethod: !!this.capabilities.files.tus_support.http_method_override, emitProgress: progress => { this.$_ocUpload_onProgress(progress, file) } diff --git a/changelog/unreleased/3568 b/changelog/unreleased/3568 new file mode 100644 index 00000000000..55f66277edb --- /dev/null +++ b/changelog/unreleased/3568 @@ -0,0 +1,11 @@ +Enhancement: Use TUS settings from capabilities + +The TUS settings advertise the maximum chunk size, so we now use the smallest chunk size from +the one configured in config.json and the one from the capabilities. + +If the capabilities report that one should use the X-HTTP-Override-Method header, +the upload will now use a POST request for uploads with that header set +instead of PATCH. + +https://github.com/owncloud/ocis-reva/issues/177 +https://github.com/owncloud/phoenix/pull/3568 diff --git a/src/plugins/upload.js b/src/plugins/upload.js index c1b4a5052a4..47253e770f3 100644 --- a/src/plugins/upload.js +++ b/src/plugins/upload.js @@ -25,6 +25,7 @@ export default { headers: headers, chunkSize: options.chunkSize || Infinity, removeFingerprintOnSuccess: true, + overridePatchMethod: !!options.overridePatchMethod, retryDelays: [0, 3000, 5000, 10000, 20000], metadata: { filename: file.name,