Only set X-OC-Mtime when browser provided lastModified on upload
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
f39de4ab37
commit
ec8bf53356
|
@ -260,14 +260,22 @@ OC.FileUpload.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
var uid = OC.getCurrentUser().uid;
|
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(
|
return this.uploader.davClient.move(
|
||||||
'uploads/' + encodeURIComponent(uid) + '/' + encodeURIComponent(this.getId()) + '/.file',
|
'uploads/' + encodeURIComponent(uid) + '/' + encodeURIComponent(this.getId()) + '/.file',
|
||||||
'files/' + encodeURIComponent(uid) + '/' + OC.joinPaths(this.getFullPath(), this.getFileName()),
|
'files/' + encodeURIComponent(uid) + '/' + OC.joinPaths(this.getFullPath(), this.getFileName()),
|
||||||
true,
|
true,
|
||||||
{
|
headers
|
||||||
'X-OC-Mtime': this.getFile().lastModified / 1000,
|
|
||||||
'OC-Total-Length': this.getFile().size
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue