25f7f8e12a691157968e8a74b932418dd30b3a50
chmalee
  Wed Oct 6 12:33:13 2021 -0700
Escaping text output by hubCheck's -htmlOut option so track hub developers can have quotes and other odd characters in their track name labels and the jstree will still work, refs Braney email

diff --git src/hg/utils/hubCheck/hubCheck.c src/hg/utils/hubCheck/hubCheck.c
index 6b40d42..b36dee8 100644
--- src/hg/utils/hubCheck/hubCheck.c
+++ src/hg/utils/hubCheck/hubCheck.c
@@ -470,45 +470,45 @@
     return TRUE;
 else
     {
     // netLineFileSilentOpen will handle 301 redirects and the like
     if (netLineFileSilentOpen(path) != NULL)
         return TRUE;
     }
 return FALSE;
 }
 
 char *makeFolderObjectString(char *id, char *text, char *parent, char *title, boolean children, boolean openFolder)
 /* Construct a folder item for one of the jstree arrays */
 {
 struct dyString *folderString = dyStringNew(0);
 dyStringPrintf(folderString, "{icon: '../../images/folderC.png', id: '%s', "
-    "text:\"%s\", parent:'%s',"
+    "text:'%s', parent:'%s',"
     "li_attr:{title:'%s'}, children:%s, state: {opened: %s}}",
-    htmlEncode(id), text, htmlEncode(parent), title, children ? "true" : "false", openFolder ? "true" : "false");
+    htmlEncode(id), htmlEncode(text), htmlEncode(parent), title, children ? "true" : "false", openFolder ? "true" : "false");
 return dyStringCannibalize(&folderString);
 }
 
 char *makeChildObjectString(char *id, char *title, char *shortLabel, char *longLabel,
     char *color, char *name, char *text, char *parent)
 /* Construct a single child item for one of the jstree arrays */
 {
 struct dyString *item = dyStringNew(0);
 dyStringPrintf(item, "{icon: 'fa fa-plus', id:'%s', li_attr:{class: 'hubError', title: '%s', "
         "shortLabel: '%s', longLabel: '%s', color: '%s', name:'%s'}, "
         "text:'%s', parent: '%s', state: {opened: true}}",
-        htmlEncode(id), title, shortLabel, longLabel, color, name, replaceChars(text, "'", "\\'"), htmlEncode(parent));
+        htmlEncode(id), title, htmlEncode(shortLabel), htmlEncode(longLabel), color, name, htmlEncode(text), htmlEncode(parent));
 return dyStringCannibalize(&item);
 }
 
 void hubErr(struct dyString *errors, char *message, struct trackHub *hub, boolean doHtml)
 /* Construct the right javascript for the jstree for a top level hub.txt error. */
 {
 if (!doHtml)
     dyStringPrintf(errors, "%s", message);
 else
     {
     char *sl;
     char *strippedMessage = NULL;
     static int count = 0; // force a unique id for the jstree object
     char id[512];
     //TODO: Choose better default labels