93f43d928860a345d712a07428af3170a34facb9 chmalee Fri Apr 5 12:33:42 2024 -0700 Make web accessible user directory link available at start time. Added a symlink to upload directory in /usr/local/apache diff --git src/hg/lib/userdata.c src/hg/lib/userdata.c index 07ebd7b..fe141aa 100644 --- src/hg/lib/userdata.c +++ src/hg/lib/userdata.c @@ -32,30 +32,46 @@ if (userDataBaseDir[0] != '/') errAbort("config setting userDataDir must be an absolute path (starting with '/')"); char *encUserName = cgiEncode(userName); char *userPrefix = md5HexForString(encUserName); userPrefix[2] = '\0'; struct dyString *newDataDir = dyStringNew(0); dyStringPrintf(newDataDir, "%s/%s/%s/", userDataBaseDir, userPrefix, encUserName); fprintf(stderr, "userDataDir = '%s'\n", newDataDir->string); return dyStringCannibalize(&newDataDir); } +char *webDataDir(char *userName) +/* Return a web accesible path to the userDataDir, this is different from the full path tusd uses */ +{ +char *retUrl = NULL; +if (userName) + { + char *encUserName = cgiEncode(userName); + char *userPrefix = md5HexForString(encUserName); + userPrefix[2] = '\0'; + struct dyString *userDirDy = dyStringNew(0); + dyStringPrintf(userDirDy, "%s/%s/%s/", HUB_SPACE_URL, userPrefix, encUserName); + retUrl = dyStringCannibalize(&userDirDy); + } +return retUrl; +} + char *prefixUserFile(char *userName, char *fname) /* Allocate a new string that contains the full per-user path to fname, NULL otherwise */ { char *pathPrefix = getDataDir(userName); if (pathPrefix) return catTwoStrings(pathPrefix, fname); else return NULL; } void removeFileForUser(char *fname, char *userName) /* Remove a file for this user if it exists */ { // The file to remove must be prefixed by the hg.conf userDataDir if (!startsWith(getDataDir(userName), fname))