a2787ccef4b1249013fc762adc2575d80709b9f1 chmalee Thu Mar 7 10:38:09 2024 -0800 Encode the highlight parameter in hgSearch links to hgTracks because the value contains a '#' character, refs #33199 diff --git src/hg/js/hgSearch.js src/hg/js/hgSearch.js index 2a97818..097e42b 100644 --- src/hg/js/hgSearch.js +++ src/hg/js/hgSearch.js @@ -487,31 +487,31 @@ if (["all_mrna", "all_est", "xenoMrna", "xenoEst", "intronEst"].includes(title)) { hgTracksTitle = title.replace(/all_/, ""); if (searchDesc.includes("Unaligned")) goToHgTracks = false; } if (goToHgTracks) { url = "hgTracks?db=" + db + "&" + hgTracksTitle + "=pack&position=" + match.position; if (match.hgFindMatches) { url += "&hgFind.matches=" + match.hgFindMatches; } if (match.extraSel) { url += "&" + match.extraSel; } if (match.highlight) { url += url[url.length-1] !== '&' ? '&' : ''; - url += "addHighlight=" + match.highlight; + url += "addHighlight=" + encodeURIComponent(match.highlight); } } else { url = "hgc?db=" + db + "&g=" + hgcTitle + "&i=" + match.position + "&c=0&o=0&l=0&r=0" ; } matchTitle = match.posName; //if (match.canonical === true) matchTitle = "" + matchTitle + ""; } var newListObj; if (printCount < 500) { if (printCount + 1 > 10) { newListObj = "
  • " + matchTitle + " - "; } @@ -928,31 +928,31 @@ } if (typeof cartJson.warning !== "undefined") { alert("Warning: " + cartJson.warning); } checkJsonData(cartJson, "init"); // check right away for a special redirect to hgTracks: if (typeof cartJson.warning === "undefined" && typeof cartJson.positionMatches !== "undefined" && cartJson.positionMatches.length == 1 && cartJson.positionMatches[0].matches[0].doRedirect === true) { positionMatch = cartJson.positionMatches[0]; match = positionMatch.matches[0]; position = match.position; newUrl = "../cgi-bin/hgTracks" + "?db=" + db + "&position=" + position; if (match.highlight) { - newUrl += "&addHighlight=" + match.highlight; + newUrl += "&addHighlight=" + encodeURIComponent(match.highlight); } if (positionMatch.name !== "chromInfo") { newUrl += "&" + positionMatch.name + "=pack"; } window.location.replace(newUrl); } var urlParts = {}; if (debugCartJson) { console.log('from server:\n', cartJson); } if (typeof cartJson.search !== "undefined") { urlParts = changeUrl({"search": cartJson.search}); } else { urlParts = changeUrl({"db": db}); cartJson.search = urlParts.urlVars.search;