373b5c4187422a9584814dcfa324028fd2e50f14
chmalee
  Tue Aug 4 15:00:30 2026 -0700
Have the pre-finish hook return the rows it wrote, and fix the table display bugs that the real row data now lets us resolve, refs #37999

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

diff --git src/hg/hgHubConnect/trackHubWizard.c src/hg/hgHubConnect/trackHubWizard.c
index 33aced2287c..6d444dc0ad5 100644
--- src/hg/hgHubConnect/trackHubWizard.c
+++ src/hg/hgHubConnect/trackHubWizard.c
@@ -148,48 +148,31 @@
 void doMoveFile(struct cartJson *cj, struct hash *paramHash)
 /* Move a file to a new hub */
 {
 }
 
 static void outUiDataForUser(struct jsonWrite *jw)
 /* List out the currently stored files for the user as well as other data
  * needed to create the hubSpace table */
 {
 char *userName = getUserName();
 jsonWriteObjectStart(jw, "userFiles");
 if (userName)
     {
     // the url for this user:
     jsonWriteString(jw, "userUrl", webDataDir(userName));
-    jsonWriteListStart(jw, "fileList");
-    struct hubSpace *file, *fileList = listFilesForUser(userName);
-    for (file = fileList; file != NULL; file = file->next)
-        {
-        jsonWriteObjectStart(jw, NULL);
-        jsonWriteString(jw, "fileName", file->fileName);
-        jsonWriteNumber(jw, "fileSize", file->fileSize);
-        jsonWriteString(jw, "fileType", file->fileType);
-        jsonWriteString(jw, "parentDir", file->parentDir);
-        jsonWriteString(jw, "genome", file->db);
-        jsonWriteString(jw, "lastModified", file->lastModified);
-        jsonWriteString(jw, "uploadTime", file->creationTime);
-        jsonWriteString(jw, "fullPath", stripDataDir(file->location, userName));
-        jsonWriteString(jw, "md5sum", file->md5sum);
-        jsonWriteString(jw, "hubType", file->hubType ? file->hubType : "trackHub");
-        jsonWriteObjectEnd(jw);
-        }
-    jsonWriteListEnd(jw);
+    hubSpaceWriteFileList(jw, userName, listFilesForUser(userName));
     }
 jsonWriteBoolean(jw, "isLoggedIn", getUserName() ? TRUE : FALSE);
 jsonWriteString(jw, "hubNameDefault", defaultHubNameForUser(getUserName()));
 // if the user is not logged, the 0 for the quota is ignored
 jsonWriteNumber(jw, "userQuota", getUserName() ? checkUserQuota(getUserName()) : 0);
 jsonWriteNumber(jw, "maxQuota", getUserName() ? getMaxUserQuota(getUserName()) : HUB_SPACE_DEFAULT_QUOTA);
 jsonWriteObjectEnd(jw);
 }
 
 void getHubSpaceUIState(struct cartJson *cj, struct hash *paramHash)
 /* Get all the data we need to make a users hubSpace UI table. The cartJson library
  * deals with printing the json */
 {
 outUiDataForUser(cj->jw);
 }