Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use chunk size and method override from caps #3568

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion apps/files/src/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,20 @@ 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
LukasHirt marked this conversation as resolved.
Show resolved Hide resolved
}
}
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)
}
Expand Down
11 changes: 11 additions & 0 deletions changelog/unreleased/3568
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/plugins/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down