544b4db19ee0f7f92c9d338d6900c34a53d9f032 chmalee Wed Jun 11 15:45:15 2025 -0700 Add back the good parts of b318572799b35, mostly have the pre-create hook set the upload path so we don't have to move files around in the pre-finish hook diff --git src/hg/hgHubConnect/hooks/hooklib.h src/hg/hgHubConnect/hooks/hooklib.h index 06eb095a07f..21592385dcd 100644 --- src/hg/hgHubConnect/hooks/hooklib.h +++ src/hg/hgHubConnect/hooks/hooklib.h @@ -1,45 +1,49 @@ /* 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 */ -void fillOutHttpResponseError(); +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 fillOutHttpResponseSuccess(); +void fillOutHttpResponseError(struct jsonElement *response); + +void fillOutHttpResponseSuccess(struct jsonElement *response); 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 */ 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 */