f081da12001f6451aca5f05a0ca153e58d332671
tdreszer
  Tue Oct 8 12:13:06 2013 -0700
Fixed braney's allergy as per redmine 11889.  Long lists of assemblies were not wrapping in the HTML table because there were no spaces.  So this now insures spaces in the list.
diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c
index 834adb4..61b43bc 100644
--- src/hg/hgHubConnect/hgHubConnect.c
+++ src/hg/hgHubConnect/hgHubConnect.c
@@ -51,46 +51,59 @@
 {
 ourCellStart();
 if (str != NULL)
     fputs(str, stdout); // do not add a newline -- was causing trailing blanks get copied in cut and paste 
 ourCellEnd();
 }
 
 static char *removeLastComma(char *string)
 {
 if (string != NULL)
     {
     int len = strlen(string);
 
     if ( string[len - 1] == ',')
 	string[len - 1]  = 0;
+    else if (len > 2 && endsWith(string,", "))
+        string[len - 2] = 0;
     }
 return string;
 }
 
 static void printGenomes(struct trackHub *thub)
 /* print supported assembly names from trackHub */
 {
 /* List of associated genomes. */
 struct trackHubGenome *genomes = thub->genomeList;
 struct dyString *dy = newDyString(100);
 
 for(; genomes; genomes = genomes->next)
     dyStringPrintf(dy,"%s, ", trackHubSkipHubName(genomes->name));
 ourPrintCell(removeLastComma( dyStringCannibalize(&dy)));
 }
 
+static void printGenomeList(struct slName *genomes)
+/* print supported assembly names from sl list */
+{
+/* List of associated genomes. */
+struct dyString *dy = newDyString(100);
+
+for(; genomes; genomes = genomes->next)
+    dyStringPrintf(dy,"%s, ", trackHubSkipHubName(genomes->name));
+ourPrintCell(removeLastComma( dyStringCannibalize(&dy)));
+}
+
 static void hgHubConnectUnlisted(struct hubConnectStatus *hubList, 
     struct hash *publicHash)
 /* Put up the list of unlisted hubs and other controls for the page. */
 /* uses publicHash to distingusih public hubs from unlisted ones */
 /* NOTE: Destroys hubList */
 {
 // put out the top of our page
 printf("<div id=\"unlistedHubs\" class=\"hubList\"> \n"
     "<table id=\"unlistedHubsTable\"> \n"
     "<thead><tr> \n"
 	"<th colspan=\"6\" id=\"addHubBar\"><label for=\"hubUrl\">URL:</label> \n"
 	"<input name=\"hubText\" id=\"hubUrl\" class=\"hubField\""
 	    "type=\"text\" size=\"65\"> \n"
 	"<input name=\"hubAddButton\""
 	    "onClick=\"hubText.value=$.trim(hubText.value);if(validateUrl($('#hubUrl').val())) { document.addHubForm.elements['hubUrl'].value=hubText.value;"
@@ -264,31 +277,31 @@
 		"class=\"hubField\" type=\"button\" value=\"check hub\">"
 		, url);
 	ourCellEnd();
 	}
     else
 	errAbort("cannot get id for hub with url %s\n", url);
 
     ourPrintCell(shortLabel);
     if (isEmpty(errorMessage))
 	ourPrintCell(longLabel);
     else
 	printf("<TD><span class=\"hubError\">ERROR: %s </span>"
 	    "<a href=\"../goldenPath/help/hgTrackHubHelp.html#Debug\">Debug</a></TD>", 
 	    errorMessage);
 
-    ourPrintCell(removeLastComma(dbList));
+    printGenomeList(slNameListFromComma(dbList)); // Leaking a bit of memory
     ourPrintCell(url);
 
     hashStore(publicHash, url);
     }
 sqlFreeResult(&sr);
 
 if (gotAnyRows)
     {
     printf("</TR></tbody></TABLE>\n");
     printf("</div>");
     }
 return publicHash;
 }