summaryrefslogtreecommitdiffstats
path: root/apps/files/js/file-upload.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2017-08-11 12:01:04 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2017-12-15 14:46:53 +0100
commitec8bf5335618b0b60737ff9a8945d2a835933259 (patch)
treef6de5c989a3d923940d60150fe78411cc02c0081 /apps/files/js/file-upload.js
parentf39de4ab375740469581809140e6dd01941e4ce1 (diff)
downloadnextcloud-server-ec8bf5335618b0b60737ff9a8945d2a835933259.tar.gz
nextcloud-server-ec8bf5335618b0b60737ff9a8945d2a835933259.zip
Only set X-OC-Mtime when browser provided lastModified on upload
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files/js/file-upload.js')
-rw-r--r--apps/files/js/file-upload.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index 1586aa3324f..8e72b3cdb41 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -260,14 +260,22 @@ OC.FileUpload.prototype = {
}
var uid = OC.getCurrentUser().uid;
+ var mtime = this.getFile().lastModified;
+ var size = this.getFile().size;
+ var headers = {};
+ if (mtime) {
+ headers['X-OC-Mtime'] = mtime / 1000;
+ }
+ if (size) {
+ headers['OC-Total-Length'] = size;
+
+ }
+
return this.uploader.davClient.move(
'uploads/' + encodeURIComponent(uid) + '/' + encodeURIComponent(this.getId()) + '/.file',
'files/' + encodeURIComponent(uid) + '/' + OC.joinPaths(this.getFullPath(), this.getFileName()),
true,
- {
- 'X-OC-Mtime': this.getFile().lastModified / 1000,
- 'OC-Total-Length': this.getFile().size
- }
+ headers
);
},