a30947b1ec3e1f14afc70537891759c32baf4154 jcasper Thu Feb 17 14:50:17 2022 -0800 Fixing small logic error - determining if a string ends with a / should be calculated on the input, not on the output you haven't written yet. No ticket. diff --git src/hg/cgilib/sessionThumbnail.c src/hg/cgilib/sessionThumbnail.c index 807b9f0..df6ab6c 100644 --- src/hg/cgilib/sessionThumbnail.c +++ src/hg/cgilib/sessionThumbnail.c @@ -20,34 +20,34 @@ * The basename of the thumbnail image is based on several pieces of data on the session: * userIdentifier is an ID for the user that is suitable for being part of a filename and * 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) == '/' ? "" : "/", + lastChar(imgDir) == '/' ? "" : "/", dyStringContents(base)); safef(thumbnailPath->forHtml, sizeof(thumbnailPath->forCgi), "%s%s%s.png", webPath, - lastChar(thumbnailPath->forCgi) == '/' ? "" : "/", + lastChar(webPath) == '/' ? "" : "/", 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) /* Returns the path to the thumbnail image of the specified session as seen by CGIs.