38fb5103beda4b0f705574c541b290b8b253e670 chmalee Mon Sep 22 12:23:38 2025 -0700 Remove 0-length characters from search strings, refs #36387 diff --git src/hg/js/hgGateway.js src/hg/js/hgGateway.js index fe6f25eab33..b90748044c2 100644 --- src/hg/js/hgGateway.js +++ src/hg/js/hgGateway.js @@ -1528,30 +1528,31 @@ uiState.db = db; clearPositionInput(); } } function onClickCopyPosition() { // Copy the displayed position into the position input: var posDisplay = $('#positionDisplay').text(); $('#positionInput').val(posDisplay).trigger("focus"); } function goToHgTracks() { // Create and submit a form for hgTracks with hidden inputs for org, db and position. var goDirectlyToHgTracks = false; var position = $('#positionInput').val(); + position = position.replace(/[\u200b-\u200d\u2060\uFEFF]/g,''); // remove 0-width chars var searchTerm = encodeURIComponent(position.replace(/^[\s]*/,'').replace(/[\s]*$/,'')); var posDisplay = $('#positionDisplay').text(); var pix = uiState.pix || calculateHgTracksWidth(); var oldCgi = cart.cgi(); cart.setCgi('hgSearch'); if (! position || position === '' || position === positionWatermark || position === selectedGene) { position = posDisplay; goDirectlyToHgTracks = true; } else { position = position.replace(/\u2013|\u2014/g, "-"); // replace en-dash and em-dash with hyphen } var $form; $form = $('<form action="hgTracks" method=GET id="mainForm">' + '<input type=hidden name="hgsid" value="' + window.hgsid + '">' +