Skip to content

Commit

Permalink
[js:core] fix #1818 mtime not defined for chunk upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Dec 22, 2016
1 parent 1bae9f0 commit e926ee6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/elFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4611,7 +4611,7 @@ elFinder.prototype = {
chunkID = new Date().getTime().toString().substr(-9), // for take care of the 32bit backend system
BYTES_PER_CHUNK = Math.min((fm.uplMaxSize? fm.uplMaxSize : 2097152) - 8190, fm.options.uploadMaxChunkSize), // uplMaxSize margin 8kb or options.uploadMaxChunkSize
blobSlice = chunkEnable? false : '',
blobSize, i, start, end, chunks, blob, chunk, added, done, last, failChunk,
blobSize, blobMtime, i, start, end, chunks, blob, chunk, added, done, last, failChunk,
multi = function(files, num){
var sfiles = [], cid, sfilesLen = 0, cancelChk;
if (!abort) {
Expand Down Expand Up @@ -4739,6 +4739,7 @@ elFinder.prototype = {
end = BYTES_PER_CHUNK;
chunks = -1;
total = Math.floor(blobSize / BYTES_PER_CHUNK);
blobMtime = blob.lastModified? Math.round(blob.lastModified/1000) : 0;

totalSize += blobSize;
chunked[chunkID] = 0;
Expand All @@ -4747,6 +4748,7 @@ elFinder.prototype = {
chunk._chunk = blob.name + '.' + (++chunks) + '_' + total + '.part';
chunk._cid = chunkID;
chunk._range = start + ',' + chunk.size + ',' + blobSize;
chunk._mtime = blobMtime;
chunked[chunkID]++;

if (size) {
Expand Down Expand Up @@ -4900,8 +4902,10 @@ elFinder.prototype = {
formData.append('chunk', file._chunk);
formData.append('cid' , file._cid);
formData.append('range', file._range);
formData.append('mtime[]', file._mtime);
} else {
formData.append('mtime[]', file.lastModified? Math.round(file.lastModified/1000) : 0);
}
formData.append('mtime[]', file.lastModified? Math.round(file.lastModified/1000) : 0);
}
if (fm.UA.iOS) {
formData.append('overwrite', 0);
Expand Down

0 comments on commit e926ee6

Please sign in to comment.