aca9143822a9c12b16b33d479a5abb6495b6b4f0 braney Wed Aug 19 06:59:39 2026 -0700 lib, hgc, hgTables, hgHubConnect: share hubEncode, refs #38123 hgc.c and hgTables.c each had their own copy of hubEncode(). The two bodies were identical, so move the function to hubConnect.c next to isHubTrack() and let both CGIs call the one definition. Also use cgiEncode() rather than htmlEncode() for the db= value in the hgHubConnect assembly list. That value goes in a query string, so cgiEncode() is the right function there. Genome names are already limited to a safe character set, so this changes no output today. diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c index bda35aa64a4..6d06af47db7 100644 --- src/hg/hgTables/hgTables.c +++ src/hg/hgTables/hgTables.c @@ -110,42 +110,30 @@ while (c == '<' && c != 0) { s = strchr(s,'>'); if (s != NULL) { if (*s == '>') ++s; /* skip closing bracket > */ c = *s++; /* next char after the closing bracket > */ } else c = 0; /* no closing bracket > found, end of string */ } *e++ = c; /* copies all text outside tags, including ending NULL */ } } -char *hubEncode(struct trackDb *tdb, char *text) -/* Return text escaped for HTML if it belongs to a track hub, otherwise return it unchanged. - * A hub's autoSql schema and data file are written by a stranger, so text from them has to be - * escaped before it goes in the page. Our own tracks are a different case: some of them - * put real HTML in a field or a schema comment on purpose, and escaping that would print the - * markup instead of rendering it. */ -{ -if (text != NULL && tdb != NULL && isHubTrack(tdb->track)) - return htmlEncode(text); -return text; -} - void writeHtmlCell(char *text) /* Write out a cell in an HTML table, making text not too big, * and stripping html tags and breaking spaces.... */ { int maxLen = 128; int len = strlen(text); char *extra = ""; if (len > maxLen) { len = maxLen; extra = " ..."; } char *s = cloneStringZ(text,len); char *r; stripHtmlTags(s);