c3c0b288edd697b9631d8236bc27091d0ae6c8ff
chmalee
  Tue Apr 30 13:41:00 2024 -0700
Get clicks from autocomplete to genark hubs working, refs #33572

diff --git src/hg/hgGateway/hgGateway.c src/hg/hgGateway/hgGateway.c
index 6da5f8a..2fbe2a9 100644
--- src/hg/hgGateway/hgGateway.c
+++ src/hg/hgGateway/hgGateway.c
@@ -929,49 +929,51 @@
     }
 hDisconnectCentral(&conn);
 return aHubMatchList;
 }
 
 static void writeGenarkMatches(struct jsonWrite *jw, struct gHubMatch *gHubMatchList)
 /* Write out JSON for each genark hub that matched the users term */
 {
 struct gHubMatch *gHubMatch;
 for (gHubMatch = gHubMatchList;  gHubMatch != NULL;  gHubMatch = gHubMatch->next)
     {
     jsonWriteObjectStart(jw, NULL);
     jsonWriteString(jw, "genome", gHubMatch->gcAccession);
     jsonWriteString(jw, "db", gHubMatch->asmName);
     jsonWriteString(jw, "hubUrl", gHubMatch->hubUrl);
+    jsonWriteString(jw, "scientificName", gHubMatch->scientificName);
     // Add a category label for customized autocomplete-with-categories.
     jsonWriteString(jw, "category", "GenArk");
     jsonWriteString(jw, "value", gHubMatch->asmName);
     // Use just the db as label, since shortLabel is included in the category label.
     jsonWriteStringf(jw, "label", "%s - %s", gHubMatch->commonName, gHubMatch->scientificName);
     jsonWriteObjectEnd(jw);
     }
 }
 
 static struct gHubMatch *filterGenarkMatches(char *genarkHubUrl, struct genark *matchList)
 /* Turn the sql results into a struct gHubMatch list */
 {
 struct genark *match;
 struct gHubMatch *ret = NULL;
 
 for (match = matchList; match != NULL; match = match->next)
     {
     // the match contains tab-sep accession, hubUrl, asmName, scientificName, commonName
-    char *hubUrl = catTwoStrings(genarkHubUrl, match->hubUrl);
+    char hubUrl[PATH_LEN+1];
+    safef(hubUrl, sizeof(hubUrl), "%s/%s", genarkHubUrl, match->hubUrl);
     slAddHead(&ret, gHubMatchNew(match->gcAccession, hubUrl, match->asmName, match->scientificName, match->commonName, -1));
     }
 return ret;
 }
 
 static struct gHubMatch *searchGenark(char *term)
 /* Search through the genark table for hubs matches term */
 {
 char *genarkPrefix = cfgOption("genarkHubPrefix");
 if (genarkPrefix == NULL)
     return NULL;
 
 struct gHubMatch *gHubMatchList = NULL;
 char *genarkTbl = genarkTableName();
 struct sqlConnection *conn = hConnectCentral();