42f9d011018e9b34cd8296ed8ebfb951465549c2
chmalee
  Mon Mar 3 15:49:39 2025 -0800
Fix undecoration of genome names bug, no need to undecorate genome names when doing download data in window request, make hubApi catch if the genome= argument is an assembly hub and act correctly, refs #34627

diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c
index 924900802c9..044b37e846a 100644
--- src/hg/hubApi/hubApi.c
+++ src/hg/hubApi/hubApi.c
@@ -1268,30 +1268,43 @@
 char *start = cgiOptionalString("start");
 char *end = cgiOptionalString("end");
 char *db = cgiOptionalString("genome");
 char *hubUrl = cgiOptionalString("hubUrl");
 struct dyString *errorMsg = dyStringNew(128);
 
 // first check for curated hubs
 if (isEmpty(hubUrl) && isNotEmpty(db))
     {
     char *newHubUrl;
     if (hubConnectGetCuratedUrl(db, &newHubUrl))
         {
         hubUrl = newHubUrl;  // use curated hub hubUrl
         cgiVarSet("hubUrl", hubUrl);   // subsequent code grabs hubUrl from env
         }
+    if (startsWith("hub_", db))
+        {
+        unsigned hubId = hubIdFromTrackName(db);
+        struct hubConnectStatus *hub = hubFromId(hubId);
+        if (hub)
+            {
+            // change up the arguments so it appears an assembly hub had been requested correctly
+            db = trackHubSkipHubName(db);
+            cgiVarSet("genome", db);
+            hubUrl = hub->hubUrl;
+            cgiVarSet("hubUrl", hubUrl);
+            }
+        }
     }
 
 if (isEmpty(hubUrl) && isNotEmpty(db))
     {
     if ( ! isGenArk(db) )
 	{
 	struct sqlConnection *conn = hAllocConnMaybe(db);
 	if (NULL == conn)
 	    dyStringPrintf(errorMsg, "can not find genome='%s' for endpoint '%s'", db, pathInfo);
 	else
 	    hFreeConn(&conn);
 	}
     }
 if (isNotEmpty(start) || isNotEmpty(end))
     {