d8cf2d55439ec62a1f62be004713039331664798
max
  Thu Aug 26 03:32:42 2021 -0700
fixing hgBlat apache error log messages, refs #28051

diff --git src/hg/hgBlat/hgBlat.c src/hg/hgBlat/hgBlat.c
index 538b44d..2d66dc7 100644
--- src/hg/hgBlat/hgBlat.c
+++ src/hg/hgBlat/hgBlat.c
@@ -550,35 +550,35 @@
 
 /* If user has hidden BLAT track, add a setting that will unhide the 
    track if user clicks on a browser link. */
 vis = cartOptionalString(cart, "hgUserPsl");
 if (vis != NULL && sameString(vis, "hide"))
     snprintf(unhideTrack, sizeof(unhideTrack), "&hgUserPsl=dense");
 else
     unhideTrack[0] = 0;
 
 while ((psl = pslNext(lf)) != NULL)
     {
     if (psl->match >= minMatchShown)
 	slAddHead(&pslList, psl);
     }
 lineFileClose(&lf);
-if (pslList == NULL)
+if (pslList == NULL && !jsonOut)
     {
     printf("<table><tr><td><hr>Sorry, no matches found");
     if (!allResults)
-	printf(" (with score at least %d)", minMatchShown);
+	printf(" (with a score of at least %d)", minMatchShown);
     printf("<hr><td></tr></table>\n");
     return;
     }
 
 pslSortListByVar(&pslList, sort);
 
 if(feelingLucky)
     {
     /* If we found something jump browser to there. */
     if(slCount(pslList) > 0)
 	printLuckyRedirect(browserUrl, pslList, database, pslName, faName, uiState, unhideTrack);
     /* Otherwise call ourselves again not feeling lucky to print empty 
        results. */
     else 
 	{
@@ -590,32 +590,35 @@
 else if (pslOut)
     {
     if (!pslRawOut)
         printf("<TT><PRE>");
     if (!sameString(output, "psl no header"))
 	pslxWriteHead(stdout, qType, tType);
 
     for (psl = pslList; psl != NULL; psl = psl->next)
 	pslTabOut(psl, stdout);
 
     if (pslRawOut)
         exit(0);
     printf("<TT><PRE>");
     printf("</PRE></TT>");
     }
-else if (jsonOut)  {
+else if (jsonOut)  
+    {
+    webStartText();
     pslWriteAllJson(pslList, stdout, database, TRUE);
+    webEndText();
     exit(0);
     }
 else  // hyperlink
     {
     printf("<H2>BLAT Search Results</H2>");
     char* posStr = cartOptionalString(cart, "position");
     if (posStr != NULL)
         printf("<P>Go back to <A HREF=\"%s\">%s</A> on the Genome Browser.</P>\n", browserUrl, posStr);
 
     if (useBigPsl)
         {
         char *trackName = NULL;
         char *trackDescription = NULL;
         getCustomName(database, cart, pslList, &trackName, &trackDescription);
         psl = pslList;