Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit 641577a

Browse files
authored
fix(various): misc areas where null values may cause problems (#1995)
1 parent 5be9ba1 commit 641577a

File tree

6 files changed

+19
-10
lines changed

6 files changed

+19
-10
lines changed

client/js/ajax.requester.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ qq.AjaxRequester = function(o) {
9191

9292
// Returns either a new XHR/XDR instance, or an existing one for the associated `File` or `Blob`.
9393
function getXhrOrXdr(id, suppliedXhr) {
94-
var xhrOrXdr = requestData[id].xhr;
94+
var xhrOrXdr = requestData[id] && requestData[id].xhr;
9595

9696
if (!xhrOrXdr) {
9797
if (suppliedXhr) {

client/js/upload-handler/upload.handler.controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ qq.UploadHandlerController = function(o, namespace) {
104104
chunked.reset(id);
105105
}
106106
else {
107-
inProgressIdx = qq.indexOf(handler._getFileState(id).chunking.inProgress, chunkIdx);
107+
var inProgressChunksArray = handler._getFileState(id).chunking.inProgress;
108+
109+
inProgressIdx = inProgressChunksArray ? qq.indexOf(inProgressChunksArray, chunkIdx) : -1;
108110
if (inProgressIdx >= 0) {
109111
handler._getFileState(id).chunking.inProgress.splice(inProgressIdx, 1);
110112
handler._getFileState(id).chunking.remaining.unshift(chunkIdx);

client/js/upload-handler/xhr.upload.handler.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ qq.XhrUploadHandler = function(spec) {
8888
qq.extend(this, {
8989
// Clear the cached chunk `Blob` after we are done with it, just in case the `Blob` bytes are stored in memory.
9090
clearCachedChunk: function(id, chunkIdx) {
91-
delete handler._getFileState(id).temp.cachedChunks[chunkIdx];
91+
var fileState = handler._getFileState(id);
92+
93+
if (fileState) {
94+
delete fileState.temp.cachedChunks[chunkIdx];
95+
}
9296
},
9397

9498
clearXhr: function(id, chunkIdx) {
@@ -542,11 +546,14 @@ qq.XhrUploadHandler = function(spec) {
542546
_shouldChunkThisFile: function(id) {
543547
var state = handler._getFileState(id);
544548

545-
if (!state.chunking) {
546-
handler.reevaluateChunking(id);
547-
}
549+
// file may no longer be available if it was recently cancelled
550+
if (state) {
551+
if (!state.chunking) {
552+
handler.reevaluateChunking(id);
553+
}
548554

549-
return state.chunking.enabled;
555+
return state.chunking.enabled;
556+
}
550557
}
551558
});
552559
};

client/js/uploader.basic.api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
var uploadData = this._uploadData.retrieve({id: id});
116116

117117
if (uploadData && uploadData.status === qq.status.UPLOAD_FINALIZING) {
118-
this.log(qq.format("Ignoring cancel for file ID {} ({}). Finalizing upload.", id, this.getName(id)), "error");
118+
this.log(qq.format("Ignoring cancel for file ID {} ({}). Finalizing upload.", id, this.getName(id)), "error");
119119
}
120120
else {
121121
this._handler.cancel(id);

client/js/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/*global qq */
2-
qq.version = "5.16.0";
2+
qq.version = "5.16.1";

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "Fine Uploader",
44
"main": "lib/traditional.js",
55
"types" : "typescript/fine-uploader.d.ts",
6-
"version": "5.16.0",
6+
"version": "5.16.1",
77
"description": "Multiple file upload plugin with progress-bar, drag-and-drop, direct-to-S3 & Azure uploading, client-side image scaling, preview generation, form support, chunking, auto-resume, and tons of other features.",
88
"keywords": [
99
"amazon",

0 commit comments

Comments
 (0)