", stdout); // do not add a newline
}
static void ourCellEnd()
{
puts("
");
}
static void ourPrintCellLink(char *str, char *url)
{
ourCellStart();
-printf("\n", url);
+// every caller passes a hub label and a hub url, both text from a stranger, so escape
+printf("\n", htmlEncode(url));
if (str != NULL)
- fputs(str, stdout); // do not add a newline -- was causing trailing blanks get copied in cut and paste
+ fputs(htmlEncode(str), stdout); // do not add a newline -- was causing trailing blanks get copied in cut and paste
puts("");
ourCellEnd();
}
static void ourPrintCell(char *str)
{
ourCellStart();
if (str != NULL)
fputs(str, stdout); // do not add a newline -- was causing trailing blanks get copied in cut and paste
ourCellEnd();
}
static char *removeLastComma(char *string)
{
if (string != NULL)
@@ -363,31 +364,31 @@
safef(id, sizeof id, "hubClearButton%d", count);
// give people a chance to clear the error
printf(""
, id);
jsOnEventByIdF("click", id,
"document.resetHubForm.elements['hubCheckUrl'].value='%s';"
"document.resetHubForm.submit(); return true;", javaScriptLiteralEncode(hub->hubUrl));
ourCellEnd();
}
else if (hub->trackHub != NULL)
{
if (hub->trackHub->descriptionUrl != NULL)
ourPrintCellLink(hub->trackHub->longLabel, hub->trackHub->descriptionUrl);
else
- ourPrintCell(hub->trackHub->longLabel);
+ ourPrintCell(htmlEncode(hub->trackHub->longLabel)); // hub supplied
}
else
ourPrintCell("");
if (hub->trackHub != NULL)
printGenomes(hub->trackHub, count, !hubHasError);
else
ourPrintCell("");
puts("");
}
printf("\n");
puts("");
@@ -686,31 +687,31 @@
}
ourCellEnd();
}
else
errAbort("cannot get id for hub with url %s\n", hubInfo->hubUrl);
ourPrintCellLink(hubInfo->shortLabel, hubInfo->hubUrl);
boolean hubHasNoError = isEmpty(hubInfo->errorMessage);
if (hubHasNoError)
{
if (hubInfo->tableHasDescriptionField && !isEmpty(hubInfo->descriptionUrl))
ourPrintCellLink(hubInfo->longLabel, hubInfo->descriptionUrl);
else
- ourPrintCell(hubInfo->longLabel);
+ ourPrintCell(htmlEncode(hubInfo->longLabel)); // hub supplied
}
else
{
ourCellStart();
printf("ERROR: %s "
"Debug Help",
hubInfo->errorMessage);
safef(jsId, sizeof jsId, "hubClearButton%d", count);
printf(
""
, jsId);
jsOnEventByIdF("click", jsId,
"document.resetHubForm.elements['hubCheckUrl'].value='%s';"
"document.resetHubForm.submit();return true;", hubInfo->hubUrl);
@@ -1432,52 +1433,54 @@
char *errorMessage;
hubFindOrAddUrlInStatusTable(cart, hub->hubUrl, &errorMessage);
// if there is an error message, we stay in hgHubConnect
if (errorMessage != NULL)
return 0;
getDbAndGenome(cart, &database, &organism, oldVars);
char headerText[1024];
safef(headerText, sizeof(headerText), "Hub Connect Successful");
cartWebStart(cart, NULL, "%s", headerText);
struct trackHub *tHub = hub->trackHub;
-hPrintf("
Connected Hub: %s
", tHub->shortLabel);
+// the labels, the email and the per genome organism and description all come out of the
+// hub's own text files, so escape them before printing
+hPrintf("
Connected Hub: %s
", htmlEncode(tHub->shortLabel));
-hPrintf("
Hub Description: %s
", tHub->longLabel);
-hPrintf("
Contact email:%s. Use this contact for all data questions.
", tHub->email, tHub->email);
+hPrintf("
Hub Description: %s
", htmlEncode(tHub->longLabel));
+hPrintf("
Contact email:%s. Use this contact for all data questions.