0fe941a11146746fafbe81dffdd317074bd27ff4
jcasper
  Thu Feb 17 14:38:35 2022 -0800
Fixing small logic error - when settings are used to force specific hgPublicSessions
paths, the web path to a file should be based on the relevant setting, not the file path setting, no ticket

diff --git src/hg/cgilib/sessionThumbnail.c src/hg/cgilib/sessionThumbnail.c
index 3cac9b8..807b9f0 100644
--- src/hg/cgilib/sessionThumbnail.c
+++ src/hg/cgilib/sessionThumbnail.c
@@ -22,31 +22,31 @@
  * presumed to be unique,
  * encSessionName is the cgi-encoded session name,
  * and firstUse is the mysql-formatted time string for the session's creation date.
  * Leaks memory via a dyString. */
 {
 struct dyString *base = dyStringCreate("hgPS_%s_%u_%ld",
     userIdentifier, hashString(encSessionName), dateToSeconds(firstUse, "%Y-%m-%d %T"));
 char *imgDir = cfgOption(IMGDIR_OPTION);
 char *webPath = cfgOption(WEBPATH_OPTION);
 if (imgDir != NULL && webPath != NULL)
     {
     makeDirsOnPath(imgDir);
     safef(thumbnailPath->forCgi, sizeof(thumbnailPath->forCgi), "%s%s%s.png", imgDir,
         lastChar(thumbnailPath->forCgi) == '/' ? "" : "/",
         dyStringContents(base));
-    safef(thumbnailPath->forHtml, sizeof(thumbnailPath->forCgi), "%s%s%s.png", imgDir,
+    safef(thumbnailPath->forHtml, sizeof(thumbnailPath->forCgi), "%s%s%s.png", webPath,
         lastChar(thumbnailPath->forCgi) == '/' ? "" : "/",
         dyStringContents(base));
     }
 else if (imgDir != NULL || webPath != NULL)
     {
     errAbort("Error with session thumbnail path configuration.  "
         "Either both %s and %s should be set in hg.conf or neither.",
         IMGDIR_OPTION, WEBPATH_OPTION);
     }
 else
     trashDirReusableFile(thumbnailPath, "hgPS", dyStringContents(base), ".png");
 }
 
 char *sessionThumbnailFilePath(char *userIdentifier, char *encSessionName,
                                char *firstUse)