465cbb88c7d13ef75dcafea5c6209bfbfe7218af
chmalee
  Fri May 12 08:29:37 2023 -0700
Fix searches that hit hub track names with special chars, refs #31234

diff --git src/hg/hgSearch/hgSearch.c src/hg/hgSearch/hgSearch.c
index c90a9ca..e2ec583c 100644
--- src/hg/hgSearch/hgSearch.c
+++ src/hg/hgSearch/hgSearch.c
@@ -614,31 +614,32 @@
 // if the search would normally be a singlePos, like a chromosome name or HGVS search,
 // we can just go directly there. But if we aren't a singlePos, we need to show
 // the results page
 boolean doRedirect = TRUE;
 measureTiming = cartUsualBoolean(cart, "measureTiming", FALSE);
 struct hgPositions *hgp = doQuery(cj->jw, db, allCategories, doRedirect, userSearch, measureTiming);
 // Since we are coming from another CGI or a URL manip, go directly to hgTracks
 // if we resolve to a single position
 if (hgp && hgp->singlePos)
     {
     char newPosBuf[128];
     safef(newPosBuf, sizeof(newPosBuf), "%s:%d-%d", hgp->singlePos->chrom, hgp->singlePos->chromStart+1, hgp->singlePos->chromEnd);
     cartSetString(cj->cart, "position", newPosBuf);
     if (hgp->singlePos->highlight)
         cartSetString(cj->cart, "addHighlight", hgp->singlePos->highlight);
-    char *trackName = hgp->tableList->name;
+    char *trackName = cloneString(hgp->tableList->name);
+    trackHubFixName(trackName);
     struct trackDb *track = NULL;
     if (!sameString(trackName, "chromInfo"))
         {
         track = tdbForTrack(db, trackName, &hgFindTdbList);
         if (!track && startsWith("all_", trackName))
             track = tdbForTrack(db, trackName+strlen("all_"), &hgFindTdbList);
         if (!track)
             errAbort("no track for table \"%s\" found via a findSpec", trackName);
         }
     puts("Content-type:text/html\n");
     puts("<HTML>\n<HEAD>\n");
     printf("<script>window.location.href=\"../cgi-bin/hgTracks?");
     printf("db=%s", db);
     printf("&position=%s", newPosBuf);
     if (!sameString(trackName, "chromInfo"))