9241b00bb206e322963c1af9d92138a836d909dd
chmalee
  Mon Oct 31 13:49:01 2022 -0700
Fix off by one on redirect searches, fix lack of cgi encoding of search terms, refs #29693

diff --git src/hg/hgSearch/hgSearch.c src/hg/hgSearch/hgSearch.c
index df50800..a609c27 100644
--- src/hg/hgSearch/hgSearch.c
+++ src/hg/hgSearch/hgSearch.c
@@ -174,31 +174,31 @@
     {
     // if we got an hgvs match to chromInfo (example: chrX:g.31500000_31600000del),
     // or just a plain position range was searched, we have to create the json
     // manually, cause the tdb lookups in hgPositionsJson() won't work
     struct hgPosTable *table = hgp->tableList;
     jsonWriteListStart(jw, "positionMatches");
     jsonWriteObjectStart(jw, NULL);
     jsonWriteString(jw, "name", table->name);
     jsonWriteString(jw, "description", table->description);
     if (table->searchTime >= 0)
         jsonWriteNumber(jw, "searchTime", table->searchTime);
     jsonWriteListStart(jw, "matches");
 
     jsonWriteObjectStart(jw, NULL);
     char position[512];
-    safef(position, sizeof(position), "%s:%d-%d", hgp->singlePos->chrom, retWinStart, retWinEnd);
+    safef(position, sizeof(position), "%s:%d-%d", hgp->singlePos->chrom, retWinStart+1, retWinEnd);
     jsonWriteString(jw, "position", position);
     jsonWriteString(jw, "posName", hgp->query);
     if (doRedirect)
         {
         // If we are coming from hgTracks or hgGateway, then we can just return right
         // back to hgTracks, the client will handle this:
         jsonWriteBoolean(jw, "doRedirect", doRedirect);
         }
     jsonWriteObjectEnd(jw);
 
     jsonWriteListEnd(jw); // end matches
     jsonWriteObjectEnd(jw); // end one table
     jsonWriteListEnd(jw); // end positionMatches
     }
 return hgp;