bc22cca38e8c981de982f705ff77a07e059e6854
hiram
  Sun Nov 22 22:35:05 2020 -0800
actually copy and replaceChars to make name for mouseOverJsonFile to make sure it is the same as pngTn names refs #21980

diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index a037f35..1eea6ae 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -5044,39 +5044,47 @@
 if (psOutput)
     {
     hvg = hvGfxOpenPostScript(pixWidth, pixHeight, psOutput);
     hvgSide = hvg; // Always only one image
     }
 else
     {
     boolean transparentImage = FALSE;
     if (theImgBox!=NULL)
         transparentImage = TRUE;   // transparent because BG (blue ruler lines) is separate image
 
     if (measureTiming)
         measureTime("Time at start of obtaining trash hgt png image file");
     trashDirFile(&pngTn, "hgt", "hgt", ".png");
     if (enableMouseOver)
-	{   /* created here at this time to get the same name as .png file */
-        /* this file name should actually be a copy of pngTn with the suffix
-         * changed png -> json since the name does have a time element thrown
-         * in.  This name needs to be identical since the javascript only sees
-         *      the .png name and thus needs to figure out the .json name
+	{   /* created here at this time to get the same name as .png file
+	     * it is copied from pngTn since if we repeated trashFileDir()
+	     * to get the name, it could be different since there is a
+	     * timestamp involved in making the name.
 	     */
         /* will open this file upon successful exit to write the data */
 	AllocVar(mouseOverJsonFile);
-	trashDirFile(mouseOverJsonFile, "hgt", "hgt", ".json");
+	char *tmpStr = cloneString(pngTn.forCgi);
+	char *jsonStr = replaceChars(tmpStr, ".png", ".json");
+	safef(mouseOverJsonFile->forCgi, ArraySize(mouseOverJsonFile->forCgi), "%s", jsonStr);
+	freeMem(tmpStr);
+	freeMem(jsonStr);
+	tmpStr = cloneString(pngTn.forHtml);
+        jsonStr = replaceChars(tmpStr, ".png", ".json");
+	safef(mouseOverJsonFile->forHtml, ArraySize(mouseOverJsonFile->forHtml), "%s", jsonStr);
+	freeMem(tmpStr);
+	freeMem(jsonStr);
 	}
     hvg = hvGfxOpenPng(pixWidth, pixHeight, pngTn.forCgi, transparentImage);
 
     if (theImgBox)
         {
         // Adds one single image for all tracks (COULD: build the track by track images)
         theOneImg = imgBoxImageAdd(theImgBox,pngTn.forHtml,NULL,pixWidth, pixHeight,FALSE);
         theSideImg = theOneImg; // Unlkess this is overwritten below, there is a single image
         }
 
     hvgSide = hvg; // Unless this is overwritten below, there is a single image
 
     if (theImgBox && theImgBox->showPortal && withLeftLabels)
         {
         // TODO: It would be great to make the two images smaller,