a6aae1e394e6092f1f44897ea954ea44af3c63ec
max
  Wed May 3 06:32:44 2023 -0700
changes after code review, refs #31069

diff --git src/hg/lib/web.c src/hg/lib/web.c
index 58247fc..977ffbd 100644
--- src/hg/lib/web.c
+++ src/hg/lib/web.c
@@ -1223,56 +1223,56 @@
 /* return dystring with subdirectory under htDocs, tolerant of missing docRoot */
 {
 struct dyString *fullDirName = NULL;
 char *docRoot = hDocumentRoot();
 if (docRoot != NULL)
     fullDirName = dyStringCreate("%s/%s", docRoot, dirName);
 else
     // tolerate missing docRoot (i.e. when running from command line)
     fullDirName = dyStringCreate("%s", dirName);
 return fullDirName;
 }
 
 char *webCssLink(char *fileName, boolean mustExist)
 /* alternative for webTimeStampedLinkToResource for CSS files: returns a string with a time-stamped
  * link to a CSS file as a html fragment <link .... >. returns empty string if file does not exist.
+ * errAborts if mustExist is True.
  * */
 {
 // construct the absolute path to the file on disk
 char *relDir = cfgOptionDefault("browser.styleDir","style");
 struct dyString *absDir = getHtdocsSubdir(relDir);
 struct dyString *absFileName = dyStringCreate("%s/%s", dyStringContents(absDir), fileName);
 
 struct dyString *htmlFrag = NULL;
 if (!fileExists(dyStringContents(absFileName)))
     {
     if (mustExist)
-        errAbort("webTimeStampedLinkToResource: file: %s doesn't exist.\n", 
-                dyStringContents(absFileName));
+        errAbort("webCssLink: file: %s doesn't exist.\n", dyStringContents(absFileName));
     else
         htmlFrag = dyStringNew(0);
     }
 else
     {
     // construct a link with the relative path to the file on the web server
     long mtime = fileModTime(dyStringContents(absFileName));
     htmlFrag = dyStringCreate("<link rel='stylesheet' href='../%s/%s?v=%ld' type='text/css'>\n", relDir, fileName, mtime);
     }
 
 dyStringFree(&absFileName);
 dyStringFree(&absDir);
-return dyStringContents(htmlFrag);
+return dyStringCannibalize(&htmlFrag);
 }
 
 char *webTimeStampedLinkToResource(char *fileName, boolean wrapInHtml)
 // If wrapInHtml
 //   returns versioned link embedded in style or script html (free after use).
 // else
 //   returns full path of a versioned path to the requested resource file (js, or css).
 // NOTE: png, jpg and gif should also be supported but are untested.
 //
 // In production sites we use a versioned softlink that includes the CGI version. This has the following benefits:
 // a) flushes user's web browser cache when the user visits a GB site whose version has changed since their last visit;
 // b) enforces the requirement that static files are the same version as the CGIs (something that often fails to happen in mirrors).
 // (see notes in redmine #3170).
 //
 // In dev trees we use mtime to create a pseudo-version; this forces web browsers to reload css/js file when it changes,