685a30331929add5218e4cae8dcff9fef35e9a0a
chmalee
  Thu Jul 31 15:46:11 2025 -0700
Feedback from code review and hgw0 testing of hubspace. If the hubspace filesystem is mounted, do the replacement in the dataDir string when first setting the dataDir (code review). Later, when stripping the dataDir off the filename to print in the UI, add a check for the mount point so we can correctly strip off the right string from the incoming filename, which will have a different path prefix than on the hbuspace machine.

diff --git src/hg/inc/userdata.h src/hg/inc/userdata.h
index 2c49013893f..31ef0d8834b 100644
--- src/hg/inc/userdata.h
+++ src/hg/inc/userdata.h
@@ -41,30 +41,38 @@
 
 char *urlForFile(char *userName, char *filePath);
 /* Return a web accessible URL to filePath */
 
 char *getEncodedUserNamePath(char *userName);
 /* Compute the path for just the userName part of the users upload */
 
 char *getDataDir(char *userName);
 /* Return the full path to the user specific data directory, can be configured via hg.conf
  * on hgwdev, this is /data/apache/userdata/userStore/hash/userName/
  * on the RR, this is /userdata/userStore/hash/userName/ */
 
 char *stripDataDir(char *fname, char *userName);
 /* Strips the getDataDir(userName) off of fname */
 
+char *swapDataDir(char *userName, char *in);
+/* Try replacing the current dataDir with what is defined in hg.conf:tusdMountPoint as
+ * the data server may be somewhere else and mounted over NFS. In this case, when
+ * tusd saves files, it is writing it's local tusdDataDir value into the hgcentral
+ * file location. When the CGI running somewhere else needs to verify file existence,
+ * the tusdDataDir won't exist on the CGI filesystem, but will instead be mounted as some
+ * different path.  In this case, replace tusdDataDir with tusdMountPoint */
+
 char *prefixUserFile(char *userName, char *fname, char *parentDir);
 /* Allocate a new string that contains the full per-user path to fname. return NULL if
  * we cannot construct a full path because of a realpath(3) failure.
  * parentDir is optional and will go in between the per-user dir and the fname */
 
 char *hubNameFromPath(char *path);
 /* Return the last directory component of path. Assume that a '.' char in the last component
  * means that component is a filename and go back further */
 
 char *writeHubText(char *path, char *userName, char *db);
 /* Create a hub.txt file, optionally creating the directory holding it. For convenience, return
  * the file name of the created hub, which can be freed. */
 
 void createNewTempHubForUpload(char *requestId, struct hubSpace *rowForFile, char *userDataDir, char *parentDir);
 /* Creates a hub.txt for this upload, and updates the hubSpace table for the