58c24abcdc7e2fe836db993243c6ac15fce457b5
chmalee
  Wed Mar 4 15:20:15 2026 -0800
Fix more universal species search bugs: hgConvert re-factor meant two hidden form variables were created for the hglft_toDb variable, so remove one of them; make organism comparison case insensitive so 'human' matches 'Human', as genark results are typically lower case; append hubUrl to hgGateway gotohgTracks form so any searched genark hub shows up as a connected hub on hgHubConnect, refs #36535, #36232

diff --git src/hg/js/hgGateway.js src/hg/js/hgGateway.js
index 080e2578916..2029b12f389 100644
--- src/hg/js/hgGateway.js
+++ src/hg/js/hgGateway.js
@@ -1715,36 +1715,45 @@
         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;
+        var hubUrlField = '';
+        if (uiState.hubUrl) {
+            var fullHubUrl = uiState.hubUrl;
+            if (!fullHubUrl.startsWith("http")) {
+                fullHubUrl = window.location.origin + fullHubUrl;
+            }
+            hubUrlField = '<input type=hidden name="hubUrl" value="' + fullHubUrl + '">';
+        }
         $form = $('<form action="hgTracks" method=GET id="mainForm">' +
                   '<input type=hidden name="hgsid" value="' + window.hgsid + '">' +
                   '<input type=hidden name="org" value="' + uiState.genome + '">' +
                   '<input type=hidden name="db" value="' + uiState.db + '">' +
                   '<input type=hidden name="position" value="' + position + '">' +
                   '<input type=hidden name="pix" value="' + pix + '">' +
+                  hubUrlField +
                   '</form>');
         // helper functions for checking whether a plain chrom name was searched for
         function onSuccess(jqXHR, textStatus) {
             if (jqXHR.chromName !== null) {
                 $('body').append($form);
                 $form.trigger("submit");
             } else  {
                 window.location.assign("../cgi-bin/hgSearch?search=" + searchTerm  + "&hgsid="+ window.hgsid );
             }
         }
         function onFail(jqXHR, textStatus) {
             window.location.assign("../cgi-bin/hgSearch?search=" + searchTerm  + "&hgsid="+ window.hgsid );
         }
         var canonMatch = position.match(canonicalRangeExp);
         var gbrowserMatch = position.match(gbrowserRangeExp);