7109422a8e5a016525dce4dbe220255a1c726729
jnavarr5
  Wed Feb 25 14:23:53 2026 -0800
Adding a fix for the parseUrl function since it was crashing when there was no queryString in the URL, which was breaking writing to the apache log for the custom track tutorial after going to the 'Manage Custom Tracks' page for the second part of the tutorial, refs #37159

diff --git src/hg/js/utils.js src/hg/js/utils.js
index fa76daf427a..65166d34acb 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -4368,31 +4368,31 @@
     });
 }
 
 function parseUrl(url) {
     // turn a url into some of it's components like server, query-string, etc
     let protocol, serverName, pathInfo, queryString, queryArgs = {};
     let temp;
     temp = url.split("?");
     if (temp.length > 1)
         queryString = temp.slice(1).join("?");
     temp = temp[0].split("/");
     protocol = temp[0]; // "https:"
     serverName = temp[2]; // "genome-test.gi.ucsc.edu"
     pathInfo = temp.slice(3).join("/"); // "cgi-bin/hgTracks"
     cgi = pathInfo.startsWith("cgi-bin") ? pathInfo.split('/')[1] : "";
-    let i, s = queryString.split('&');
+    let i, s = queryString ? queryString.split('&') : []; // Fix for when there is no query string in the URL
     for (i = 0; i < s.length; i++) {
         argVal = s[i].split('=');
         queryArgs[argVal[0]] = argVal[1];
     }
     return {protocol: protocol, serverName: serverName, pathInfo: pathInfo, queryString: queryString, cgi: cgi, queryArgs: queryArgs};
 }
 
 function dumpCart(seconds, skipNotification) {
     // dump current cart
     let currUrl = parseUrl(window.location.href);
     logUrl = currUrl.protocol + "//" + currUrl.serverName + "/" + currUrl.pathInfo + "?hgsid=" + getHgsid() + "&_dumpCart=" + encodeURIComponent(seconds) + "&skipNotif=" + skipNotification;
     let xmlhttp = new XMLHttpRequest();
     xmlhttp.open("GET", logUrl, true);
     xmlhttp.send();  // sends request and exits this function
 }