17c23271d8e3b97b89d6e3b9ded90d1c14d3e23d max Tue Nov 3 00:25:20 2015 -0800 fixing off-by-one errors in external tools menu, refs #16308 diff --git src/hg/hgTracks/extTools.c src/hg/hgTracks/extTools.c index 93db442..3ddea04 100644 --- src/hg/hgTracks/extTools.c +++ src/hg/hgTracks/extTools.c @@ -168,59 +168,64 @@ errAbort("No configuration found for tool %s", tool); // construct an invisible CGI form with the given parameters printf("<html><body>\n"); if (debug) printf("Target URL: %s<p>", et->url); char *chromName; int winStart, winEnd; char *db = cartString(cart, "db"); char *pos = cartString(cart, "position"); findGenomePos(db, pos, &chromName, &winStart, &winEnd, cart); int len = winEnd-winStart; +char start1[255]; +safef(start1, sizeof(start1), "%d", winStart+1); + char *url = replaceInUrl(et->url, "", cart, db, chromName, winStart, winEnd, NULL, TRUE); char *method = "POST"; if (et->isHttpGet) method = "GET"; printf("<form id=\"redirForm\" method=\"%s\" action=\"%s\">\n", method, url); struct slPair *slp; if (et->maxSize!=0 && len > et->maxSize) { printf("Sorry, this tool accepts only a sequence with less than %d base pairs<p>\n" "Please zoom in some more.<p>\n", et->maxSize); return; } printf("You're being redirected from the UCSC Genome Browser to the site %s<br>\n", url); if (et->email) printf("Please contact %s for questions on this tool.<br>\n", et->email); boolean submitDone = FALSE; for (slp=et->params; slp!=NULL; slp=slp->next) { char* val = slp->val; if (sameWord(val, "$db")) val = db; if (sameWord(val, "$position")) val = pos; + if (sameWord(val, "$start1")) + val = start1; if (sameWord(val, "$returnUrl")) { // get the full URL of this hgTracks page, so external page can construct a custom track // and link back to us char* host = getenv("HTTP_HOST"); char* reqUrl = getenv("REQUEST_URI"); // remove everything after ? in URL char *e = strchr(reqUrl, '?'); if (e) *e = 0; char url[4000]; // cannot find a way to find out if the request came in via http or https safef(url, sizeof(url), "http://%s%s", host, reqUrl); val = url; }