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

Add TUS creation-with-upload support #3436

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 12 additions & 2 deletions apps/files/src/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,16 @@ export default {
relativePath = pathUtil.join(basePath, relativePath)
// 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) {
if (this.browserSupportsChunked && this.currentFolder.chunkUploadSupport) {
const extraOptions = {}
// enable direct upload if enabled and supported
// instead of create + upload in two requests
if (
this.configuration.uploadChunkDirect &&
this.currentFolder.chunkUploadSupport.extension.includes('creation-with-upload')
) {
extraOptions.uploadDataDuringCreation = true
}
let chunkSize = this.configuration.uploadChunkSize
if (this.capabilities.files.tus_support.max_chunk_size > 0) {
if (
Expand All @@ -463,7 +472,8 @@ export default {
overridePatchMethod: !!this.capabilities.files.tus_support.http_method_override,
emitProgress: progress => {
this.$_ocUpload_onProgress(progress, file)
}
},
...extraOptions
})
})
} else {
Expand Down
2 changes: 1 addition & 1 deletion apps/files/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function _buildFile(file) {
isReceivedShare: function() {
return this.permissions.indexOf('S') >= 0
},
isChunkedUploadSupported: !!(file.getTusSupport && file.getTusSupport())
chunkUploadSupport: !!file.getTusSupport && file.getTusSupport()
}
}

Expand Down
1 change: 1 addition & 0 deletions src/plugins/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
removeFingerprintOnSuccess: true,
overridePatchMethod: !!options.overridePatchMethod,
retryDelays: [0, 3000, 5000, 10000, 20000],
uploadDataDuringCreation: options.uploadDataDuringCreation || false,
metadata: {
filename: file.name,
filetype: file.type,
Expand Down
1 change: 1 addition & 0 deletions src/store/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const mutations = {
state.openIdConnect = config.openIdConnect
state.rootFolder = config.rootFolder === undefined ? '/' : config.rootFolder
state.uploadChunkSize = config.uploadChunkSize === undefined ? Infinity : config.uploadChunkSize
state.uploadChunkDirect = config.uploadChunkDirect !== false // defaults to true if undefined
state.state = config.state === undefined ? 'working' : config.state
state.applications = config.applications === undefined ? [] : config.applications
if (config.corrupted) state.corrupted = config.corrupted
Expand Down