summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-10-07 16:27:54 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2017-11-03 17:19:23 +0100
commitcd8d13b9e6e7bbf0e17f31c60021804ac4772939 (patch)
treeebdc418958ec2a8047a5cafa774c5c8a47ae21ec /core/js
parent8ee765a61743db31749b0bdb51ce09915458325f (diff)
downloadnextcloud-server-cd8d13b9e6e7bbf0e17f31c60021804ac4772939.tar.gz
nextcloud-server-cd8d13b9e6e7bbf0e17f31c60021804ac4772939.zip
Enable chunking for bigger files in authenticated web upload
This commit adds chunked uploads in the Web UI (for authenticated users, but not for public uploads). To do that the server endpoint used by the uploader is changed from WebDAV v1 to WebDAV v2. The chunking itself is done automatically by the jQuery-File-Upload plugin when the "maxChunkSize" parameter is set; in "fileuploadchunksend" the request is adjusted to adapt the behaviour of the plugin to the one expected by "uploads/" in WebDAV v2. The chunk size to be used by the Web UI can be set in the "max_chunk_size" parameter of the Files app configuration. By default it is set to 10MiB. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core/js')
-rw-r--r--core/js/files/client.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/core/js/files/client.js b/core/js/files/client.js
index dc9f6ade641..e810381342a 100644
--- a/core/js/files/client.js
+++ b/core/js/files/client.js
@@ -37,6 +37,7 @@
}
url += options.host + this._root;
+ this._host = options.host;
this._defaultHeaders = options.defaultHeaders || {
'X-Requested-With': 'XMLHttpRequest',
'requesttoken': OC.requestToken
@@ -698,10 +699,11 @@
* @param {String} destinationPath destination path
* @param {boolean} [allowOverwrite=false] true to allow overwriting,
* false otherwise
+ * @param {Object} [headers=null] additional headers
*
* @return {Promise} promise
*/
- move: function(path, destinationPath, allowOverwrite) {
+ move: function(path, destinationPath, allowOverwrite, headers) {
if (!path) {
throw 'Missing argument "path"';
}
@@ -712,9 +714,9 @@
var self = this;
var deferred = $.Deferred();
var promise = deferred.promise();
- var headers = {
+ headers = _.extend({}, headers, {
'Destination' : this._buildUrl(destinationPath)
- };
+ });
if (!allowOverwrite) {
headers.Overwrite = 'F';
@@ -828,6 +830,16 @@
*/
getBaseUrl: function() {
return this._client.baseUrl;
+ },
+
+ /**
+ * Returns the host
+ *
+ * @since 13.0.0
+ * @return {String} base URL
+ */
+ getHost: function() {
+ return this._host;
}
};