Skip to content

Commit 27764f0

Browse files
Use PageFlowUtil.jsString to escape container path (#522)
- Use PageFlowUtil.jsString to escape container path. - HTML-escape the abstract, experiment and sample descriptions displayed by dropDownUtils.js Co-authored-by: Josh Eckels <jeckels@labkey.com>
1 parent f060b04 commit 27764f0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

panoramapublic/src/org/labkey/panoramapublic/query/ExperimentAnnotationsTableInfo.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@ public void renderGridCellContents(RenderContext ctx, Writer out) throws IOExcep
162162
.at(src, PageFlowUtil.staticResourceUrl("_images/plus.gif"))),
163163
HtmlString.NBSP)
164164
.appendTo(out);
165-
pageConfig.addHandler(spanId, "click", "viewExperimentDetails(this,'" + container.getPath() + "', '" + id + "','" + detailsPage + "')");
165+
pageConfig.addHandler(spanId, "click", "viewExperimentDetails(this,"
166+
+ PageFlowUtil.jsString(container.getPath())
167+
+ ", " + id + ", "
168+
+ PageFlowUtil.jsString(detailsPage) + ")");
166169
}
167170
super.renderGridCellContents(ctx, out);
168171
}

panoramapublic/webapp/PanoramaPublic/js/dropDownUtil.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,13 @@ viewExperimentDetails = function (obj, experimentContainer, id, detailsPageURL)
6666
var results;
6767
if(object.rows[rowNum][type] != null)
6868
{
69-
if(object.rows[rowNum][type].length > 500)
69+
let description = object.rows[rowNum][type];
70+
if(description.length > 500)
7071
{
71-
results = object.rows[rowNum][type].substring(0,500)+"<a href='"+detailsPageURL+"'>...more.</a>";
72+
results = LABKEY.Utils.encodeHtml(description.substring(0,500)) +"<a href=\""+ LABKEY.Utils.encodeHtml(detailsPageURL) +"\">...more.</a>";
7273
}
7374
else {
74-
results =object.rows[rowNum][type];
75+
results = LABKEY.Utils.encodeHtml(description);
7576
}
7677
}
7778
else {results = null;}

0 commit comments

Comments
 (0)