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

Commit

Permalink
fix(various): misc areas where null values may cause problems (#1995)
Browse files Browse the repository at this point in the history
  • Loading branch information
rnicholus committed Apr 10, 2018
1 parent 5be9ba1 commit 641577a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client/js/ajax.requester.js
Expand Up @@ -91,7 +91,7 @@ qq.AjaxRequester = function(o) {

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

if (!xhrOrXdr) {
if (suppliedXhr) {
Expand Down
4 changes: 3 additions & 1 deletion client/js/upload-handler/upload.handler.controller.js
Expand Up @@ -104,7 +104,9 @@ qq.UploadHandlerController = function(o, namespace) {
chunked.reset(id);
}
else {
inProgressIdx = qq.indexOf(handler._getFileState(id).chunking.inProgress, chunkIdx);
var inProgressChunksArray = handler._getFileState(id).chunking.inProgress;

inProgressIdx = inProgressChunksArray ? qq.indexOf(inProgressChunksArray, chunkIdx) : -1;
if (inProgressIdx >= 0) {
handler._getFileState(id).chunking.inProgress.splice(inProgressIdx, 1);
handler._getFileState(id).chunking.remaining.unshift(chunkIdx);
Expand Down
17 changes: 12 additions & 5 deletions client/js/upload-handler/xhr.upload.handler.js
Expand Up @@ -88,7 +88,11 @@ qq.XhrUploadHandler = function(spec) {
qq.extend(this, {
// Clear the cached chunk `Blob` after we are done with it, just in case the `Blob` bytes are stored in memory.
clearCachedChunk: function(id, chunkIdx) {
delete handler._getFileState(id).temp.cachedChunks[chunkIdx];
var fileState = handler._getFileState(id);

if (fileState) {
delete fileState.temp.cachedChunks[chunkIdx];
}
},

clearXhr: function(id, chunkIdx) {
Expand Down Expand Up @@ -542,11 +546,14 @@ qq.XhrUploadHandler = function(spec) {
_shouldChunkThisFile: function(id) {
var state = handler._getFileState(id);

if (!state.chunking) {
handler.reevaluateChunking(id);
}
// file may no longer be available if it was recently cancelled
if (state) {
if (!state.chunking) {
handler.reevaluateChunking(id);
}

return state.chunking.enabled;
return state.chunking.enabled;
}
}
});
};
2 changes: 1 addition & 1 deletion client/js/uploader.basic.api.js
Expand Up @@ -115,7 +115,7 @@
var uploadData = this._uploadData.retrieve({id: id});

if (uploadData && uploadData.status === qq.status.UPLOAD_FINALIZING) {
this.log(qq.format("Ignoring cancel for file ID {} ({}). Finalizing upload.", id, this.getName(id)), "error");
this.log(qq.format("Ignoring cancel for file ID {} ({}). Finalizing upload.", id, this.getName(id)), "error");
}
else {
this._handler.cancel(id);
Expand Down
2 changes: 1 addition & 1 deletion client/js/version.js
@@ -1,2 +1,2 @@
/*global qq */
qq.version = "5.16.0";
qq.version = "5.16.1";
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -3,7 +3,7 @@
"title": "Fine Uploader",
"main": "lib/traditional.js",
"types" : "typescript/fine-uploader.d.ts",
"version": "5.16.0",
"version": "5.16.1",
"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.",
"keywords": [
"amazon",
Expand Down

0 comments on commit 641577a

Please sign in to comment.