94041c12e043016875ebd340568bda0ccaf122f6
lrnassar
  Wed Jul 8 13:53:22 2026 -0700
Add db= to cross-CGI hgTracks/hgTrackUi/hgc links to prevent wrong-assembly errors. refs #37840

Completes the incomplete work from #26892: links from the browser to a different
CGI omitted db=, so the target CGI fell back to the cart's db (often wrong),
producing "Can't find <track> in track database <db>" errors and broken shared
links. Adds the current-assembly db to link builders across hgTracks
(chromGraphTrack, expRatioTracks, config ruler and per-track configure links,
variation), hgVai, hgFileUi, hgGtexTrackSettings, hgBlat, hgGene, hgNear, the
barChart/GTEx faceted UI (facetedBar, barChartUi, gtexUi), and the hgTrackUi
group-configure link.

diff --git src/hg/hgGtexTrackSettings/hgGtexTrackSettings.c src/hg/hgGtexTrackSettings/hgGtexTrackSettings.c
index c7cface7d4a..b5a411d1881 100644
--- src/hg/hgGtexTrackSettings/hgGtexTrackSettings.c
+++ src/hg/hgGtexTrackSettings/hgGtexTrackSettings.c
@@ -63,35 +63,35 @@
 "<!-- Info icon built from stacked fa icons -->\n"
 "           <a href='#INFO_SECTION' title='Jump to the track description'>\n"
 "               <span class='gbIconSmall fa-stack'>\n"
 "                   <i class='gbBlueDarkColor fa fa-circle fa-stack-2x'></i>\n"
 "                   <i class='gbWhiteColor fa fa-info fa-stack-1x'></i>\n"
 "               </span></a>\n"
 );
 
 if (tdb->parent)
     {
     // link to supertrack
     char *encodedMapName = cgiEncode(tdb->parent->track);
     char *chromosome = cartUsualString(cart, "c", hDefaultChrom(database));
     puts("&nbsp;");
     printf(
-    "       <a href='%s?%s=%s&c=%s&g=%s' title='Go to container track (%s)'>\n"
+    "       <a href='%s?%s=%s&db=%s&c=%s&g=%s' title='Go to container track (%s)'>\n"
     "           <i class='gbIconLevelUp fa fa-level-up'></i>\n"
     "       </a>\n",
                 hgTrackUiName(), cartSessionVarName(), cartSessionId(cart),
-                chromosome, encodedMapName, tdb->parent->shortLabel
+                database, chromosome, encodedMapName, tdb->parent->shortLabel
     );
     freeMem(encodedMapName);
     }
 puts(
 "       </div>\n"
 );
 puts(
 "       <div class='col-md-2 text-right'>\n"
 );
 printGoButton();
 puts(
 "       </div>\n"
 "   </div>\n"
 );
 }