# HG changeset patch # User Giulio Moro # Date 1457799817 0 # Node ID 34d8bca65edcc61f93ab6427d0a170679e78897a # Parent 0256f3748b27b408862e1de7e108cb774ce3651d Allow for returnUrl===undefined diff -r 0256f3748b27 -r 34d8bca65edc core.js --- a/core.js Sat Mar 12 15:32:30 2016 +0000 +++ b/core.js Sat Mar 12 16:23:37 2016 +0000 @@ -375,15 +375,17 @@ destUrlFull = destURL+"?key="+storage.SessionKey.key; var saveFilenamePrefix; // parse the querystring of destUrl, get the "id" (if any) and append it to destUrl - var qs = returnUrl.split("?"); - if(qs.length == 2){ - qs = qs[1]; - qs = qs.split("&"); - for(var n = 0; n < qs.length; n++){ - var pair = qs[n].split("="); - if (pair[0] == "id") { - saveFilenamePrefix = pair[1]; - } + if(typeof(returnUrl) !== "undefined"){ + var qs = returnUrl.split("?"); + if(qs.length == 2){ + qs = qs[1]; + qs = qs.split("&"); + for(var n = 0; n < qs.length; n++){ + var pair = qs[n].split("="); + if (pair[0] == "id") { + saveFilenamePrefix = pair[1]; + } + } } } if(typeof(saveFilenamePrefix) !== "undefined"){ @@ -408,7 +410,7 @@ window.onbeforeunload=null; if (response.getAttribute("state") == "OK") { var file = response.getElementsByTagName("file")[0]; - if(typeof(returnUrl) !== "undefined"){ + if(typeof(returnUrl) !== "undefined"){ window.location = returnUrl; } console.log("Save: OK, written "+file.getAttribute("bytes")+"B");