3fbd5278d976e75ab044723b2356bea81ab4aa26
markd
Thu Sep 15 13:04:15 2016 -0700
Always encode item names when generating URLs in hgcAnchorSomewhere. This prevents item names with CGI-unsafe characters from being incorrectly encode. This was happening with PSLs, but could happen in other structures
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index 809c9a8..647f4a0 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -513,33 +513,35 @@
{
static struct dyString *dy = NULL;
if (dy == NULL)
{
dy = newDyString(128);
dyStringPrintf(dy, "%s?%s", hgcName(), cartSidUrlString(cart));
}
return dy->string;
}
void hgcAnchorSomewhere(char *group, char *item, char *other, char *chrom)
/* Generate an anchor that calls click processing program with item
* and other parameters. */
{
char *tbl = cgiUsualString("table", cgiString("g"));
+char *itemSafe = cgiEncode(item);
printf("",
- hgcPathAndSettings(), group, item, chrom, winStart, winEnd, other,
+ hgcPathAndSettings(), group, itemSafe, chrom, winStart, winEnd, other,
tbl);
+freeMem(itemSafe);
}
void hgcAnchorPosition(char *group, char *item)
/* Generate an anchor that calls click processing program with item
* and group parameters. */
{
char *tbl = cgiUsualString("table", cgiString("g"));
printf("",
hgcPathAndSettings(), group, item, tbl);
}
void hgcAnchorWindow(char *group, char *item, int thisWinStart,
int thisWinEnd, char *other, char *chrom)
/* Generate an anchor that calls click processing program with item
* and other parameters, INCLUDING the ability to specify left and
@@ -5880,32 +5882,31 @@
struct psl *psl = pslList;
for (psl = pslList; psl != NULL; psl = psl->next)
{
if ( pslTrimToTargetRange(psl, winStart, winEnd) != NULL
&&
!startsWith("xeno", tableName)
&& !(startsWith("user", tableName) && pslIsProtein(psl))
&& psl->tStart == startFirst
&& sameString(psl->tName, seqName)
)
{
char otherString[512];
safef(otherString, sizeof(otherString), "%d&aliTable=%s",
psl->tStart, tableName);
- hgcAnchorSomewhere(hgcCommandInWindow, cgiEncode(itemIn),
- otherString, psl->tName);
+ hgcAnchorSomewhere(hgcCommandInWindow, itemIn, otherString, psl->tName);
printf("
View details of parts of alignment within browser window.
\n");
}
}
}
void printAlignments(struct psl *pslList, int startFirst, char *hgcCommand,
char *tableName, char *itemIn)
/* Print list of mRNA alignments. */
{
printAlignmentsExtra(pslList, startFirst, hgcCommand, "htcCdnaAliInWindow", tableName, itemIn);
}
struct psl *getAlignments(struct sqlConnection *conn, char *table, char *acc)
/* get the list of alignments for the specified acc */
{
@@ -20834,31 +20835,31 @@
, smp->chromStart+smp->samplePosition[smp->sampleCount-1] );
pslSr = sqlGetResult(conn2, query);
if(!sameString(winOn,"T"))
{
while(( pslRow = sqlNextRow(pslSr)) != NULL )
{
thisPsl = pslLoad( pslRow+hasBin );
firstAndLastPosition( &thisStart, &thisEnd, thisPsl );
snprintf(thisItem, 256, "%s:%d-%d %s:%d-%d", thisPsl->qName,
thisPsl->qStart, thisPsl->qEnd, thisPsl->tName,
thisPsl->tStart, thisPsl->tEnd );
longXenoPsl1Given(tdb, thisItem, otherOrg, "chromInfo",
otherDb, thisPsl, pslTableName );
safef(otherString, sizeof otherString, "%d&win=T", thisPsl->tStart );
- hgcAnchorSomewhere( tdb->track, cgiEncode(item), otherString, thisPsl->tName );
+ hgcAnchorSomewhere( tdb->track, item, otherString, thisPsl->tName );
printf("View individual alignment windows\n");
printf("
");
}
}
else
{
cartSetString( cart, "win", "F" );
printf("