changeset 609:34d8bca65edc multiple-tests-concatenation

Allow for returnUrl===undefined
author Giulio Moro <giuliomoro@yahoo.it>
date Sat, 12 Mar 2016 16:23:37 +0000
parents 0256f3748b27
children babcc4ac48eb
files core.js
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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");