5fbd341691cc520c5d274e50373797de05de9262 chmalee Tue Sep 23 13:28:19 2025 -0700 Remove 0-width characters before calling encodeURIComponent on hgTracks search box, refs #36387 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 0597787ea69..c11103f1a8c 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -4986,32 +4986,32 @@ window.location.assign(url); return false; } // redirect to hgBlat if the input looks like a DNA sequence // minimum length=19 so we do not accidentally redirect to hgBlat for a gene identifier // like ATG5 var dnaRe = new RegExp("^(>[^\n\r ]+[\n\r ]+)?(\\s*[actgnACTGN \n\r]{19,}\\s*)$"); if (dnaRe.test(newPos)) { var blatUrl = "hgBlat?type=BLAT%27s+guess&userSeq="+newPos; window.location.href = blatUrl; return false; } // helper functions for checking whether a plain chrom name was searched for - term = encodeURIComponent(genomePos.get().replace(/^[\s]*/,'').replace(/[\s]*$/,'')); - term = term.replace(/[\u200b-\u200d\u2060\uFEFF]/g,''); // remove 0-width chars + term = genomePos.get().replace(/[\u200b-\u200d\u2060\uFEFF]/g,''); // remove 0-width chars + term = encodeURIComponent(term.replace(/^[\s]*/,'').replace(/[\s]*$/,'')); function onSuccess(jqXHR, textStatus) { if (jqXHR.chromName !== null) { imageV2.markAsDirtyPage(); imageV2.navigateInPlace("db=" + getDb() + "&position=" + encodeURIComponent(newPos), null, false); window.scrollTo(0,0); } else { window.location.assign("../cgi-bin/hgSearch?search=" + term + "&hgsid="+ getHgsid()); } } function onFail(jqXHR, textStatus) { window.location.assign("../cgi-bin/hgSearch?search=" + term + "&hgsid="+ getHgsid()); } // redirect to search disambiguation page if it looks like we didn't enter a regular position: var canonMatch = newPos.match(canonicalRangeExp);