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) diff --git src/hg/hgHubConnect/hooks/hooklib.h src/hg/hgHubConnect/hooks/hooklib.h index 7631fdf0c77..728c4594e70 100644 --- src/hg/hgHubConnect/hooks/hooklib.h +++ src/hg/hgHubConnect/hooks/hooklib.h @@ -1,62 +1,66 @@ /* hooklib - Common routines for all the tusd hooks */ /* Copyright (C) 2008 The Regents of the University of California * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */ #ifndef HOOKLIB_H #define HOOKLIB_H #define ERR_MSG "errorMessage" #define REJECT_SETTING "RejectUpload" #define STOP_SETTING "StopUpload" #define HTTP_NAME "HTTPResponse" #define HTTP_STATUS "StatusCode" #define HTTP_BODY "Body" #define HTTP_HEADER "Header" #define HTTP_CONTENT_TYPE "Content-Type" #define HTTP_CONTENT_TYPE_STR "application/json" char *prettyFileSize(long size); /* Return a string representing the size of a file */ char *encodePath(char *path); /* Return a string where each individual component of a '/' separated * string has been cgiEncoded, but not the '/' chars themselves */ char *normalizeParentDir(char *parentDir); /* Return parentDir with any surrounding whitespace trimmed off, or NULL if it was NULL. * Every hook that builds a path from this metadata value must normalize it the same way */ boolean isValidParentDir(char *parentDir); /* Return TRUE if every '/' separated component of parentDir holds only alphanumeric, * period or underscore characters. NULL or empty is invalid, every upload belongs to * a hub */ char *setUploadPath(char *userName, char *fileName, char *parentDir, boolean forceOverwrite); /* return the path, relative to hg.conf tusdDataDir, where we will store this upload * the full path would be /tusdDataDir/userNamePrefix/userName/parentDir/fileName */ void fillOutHttpResponseError(struct jsonElement *response); void fillOutHttpResponseSuccess(struct jsonElement *response); +void setUploadedFileList(struct jsonElement *response, char *userName, struct hubSpace *fileList); +/* Put the hubSpace rows this upload created or changed into the response body. tusd + * forwards the body to the client, which shows the rows the server actually holds */ + struct jsonElement *makeDefaultResponse(); /* Create the default response json with some fields pre-filled */ void rejectUpload(struct jsonElement *response, char *msg, ...) /* Set the keys for stopping an upload */ #if defined(__GNUC__) __attribute__((format(printf, 2, 3))) #endif ; boolean isFileTypeRecognized(char *fileName); /* Return true if this file one of our recognized types */ boolean isExistingHubForUser(char *userName, char *reqHubName); /* Return true if hubName is an existing hub for this user */ char *genomeForHub(char *userName, char *reqHubName); /* Return the genome associated with reqHubName for user */ #endif /* HOOKLIB_H */