a4c8987ac13d72f85a7c3adde3f867456a85516f
chmalee
  Thu Sep 26 15:52:46 2024 -0700
Save newly created hubs to file table, return hubs when loading the page

diff --git src/hg/hgHubConnect/hooks/post-finish.c src/hg/hgHubConnect/hooks/post-finish.c
index 3e5aa59..a70a16d 100644
--- src/hg/hgHubConnect/hooks/post-finish.c
+++ src/hg/hgHubConnect/hooks/post-finish.c
@@ -6,30 +6,31 @@
 #include "linefile.h"
 #include "hash.h"
 #include "options.h"
 #include "wikiLink.h"
 #include "customTrack.h"
 #include "userdata.h"
 #include "jsonQuery.h"
 #include "jsHelper.h"
 #include "errCatch.h"
 #include "obscure.h"
 #include "hooklib.h"
 #include "jksql.h"
 #include "hdb.h"
 #include "hubSpace.h"
 #include "md5.h"
+#include "cheapcgi.h"
 
 void usage()
 /* Explain usage and exit. */
 {
 errAbort(
   "post-finish - tus daemon post-finish hook program\n"
   "usage:\n"
   "   post-finish < input\n"
   );
 }
 
 /* Command line validation table. */
 static struct optionSpec options[] = {
    {NULL, 0},
 };
@@ -74,31 +75,31 @@
         char *reqCookie= jsonQueryString(req, "", "Event.HTTPRequest.Header.Cookie[0]", NULL);
         if (reqCookie)
             {
             setenv("HTTP_COOKIE", reqCookie, 0);
             }
         fprintf(stderr, "reqCookie='%s'\n", reqCookie);
         userName = (loginSystemEnabled() || wikiLinkEnabled()) ? wikiLinkUserName() : NULL;
         fprintf(stderr, "userName='%s'\n'", userName);
         if (!userName)
             {
             errAbort("not logged in");
             }
         else
             {
             // NOTE: All Upload.MetaData values are strings
-            fileName = jsonQueryString(req, "", "Event.Upload.MetaData.fileName", NULL);
+            fileName = cgiEncodeFull(jsonQueryString(req, "", "Event.Upload.MetaData.fileName", NULL));
             fileSize = jsonQueryInt(req, "",  "Event.Upload.Size", 0, NULL);
             fileType = jsonQueryString(req, "", "Event.Upload.MetaData.fileType", NULL);
             db = jsonQueryString(req, "", "Event.Upload.MetaData.genome", NULL);
             reqLm = jsonQueryString(req, "", "Event.Upload.MetaData.lastModified", NULL);
             lastModified = sqlLongLong(reqLm) / 1000; // yes Javascript dates are in millis
             char *tusFile = jsonQueryString(req, "", "Event.Upload.Storage.Path", NULL);
             if (fileName == NULL)
                 {
                 errAbort("No Event.Upload.fileName setting");
                 }
             else if (tusFile == NULL)
                 {
                 errAbort("No Event.Path setting");
                 }
             else