519ce0fc9ae99aa8150751bcd69a77263a6d8ca0
braney
  Wed Mar 15 12:22:57 2017 -0700
fix a possible problem with mirrors using a complicated path for their
cgi's

diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 2648d9b..17a6e82 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -25181,31 +25181,31 @@
 char *trackDescription = cartString(cart, "trackDescription");
 char *pslName, *faName, *qName;
 parseSs(fileNames, &pslName, &faName, &qName);
 
 struct tempName bigBedTn;
 trashDirDateFile(&bigBedTn, "hgBlat", "bp", ".bb");
 char *bigBedFile = bigBedTn.forCgi;
 makeBigPsl(pslName, faName, database, bigBedFile);
 
 char* host = getenv("HTTP_HOST");
 char* reqUrl = cloneString(getenv("REQUEST_URI"));
 // delete arguements to the url
 char *e = strchr(reqUrl+1, '?');
 if (e) *e = 0;
 // remove the cgi name
-e = strchr(reqUrl+1, '/');
+e = strrchr(reqUrl, '/');
 if (e) *e = 0;
 
 boolean isProt = cgiOptionalString("isProt") != NULL;
 char *customTextTemplate = "track type=bigPsl indelDoubleInsert=on indelQueryInsert=on  pslFile=%s visibility=pack showAll=on htmlUrl=http://%s/goldenPath/help/hgUserPsl.html %s bigDataUrl=http://%s%s/%s name=\"%s\" description=\"%s\"\n";  
 char *extraForMismatch = "showDiffBasesAllScales=. baseColorUseSequence=lfExtra baseColorDefault=diffBases";
   
 if (isProt)
     extraForMismatch = "";
 char buffer[4096];
 safef(buffer, sizeof buffer, customTextTemplate, bigBedTn.forCgi, host, extraForMismatch, host, reqUrl, bigBedTn.forCgi, trackName, trackDescription);
 
 struct customTrack *ctList = getCtList();
 struct customTrack *newCts = customFactoryParse(database, buffer, FALSE, NULL);
 theCtList = customTrackAddToList(ctList, newCts, NULL, FALSE);