Skip to content

Commit

Permalink
XWIKI-17374: Fix escaping in property displayer
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelleduc committed Sep 9, 2020
1 parent 5cf8995 commit 9ad8a79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,13 @@ public void displayEdit(StringBuffer buffer, String name, String prefix, BaseCol
public void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object,
XWikiContext context)
{
String content = getPropertyText((BaseProperty) object.safeget(name));
buffer.append(XMLUtils.escapeElementText(content));
}

/**
* Get the text of the base property. Returns the empty string if the base property is null.
* @param property the base property
* @return the text of the base property. The empty string is returned if the base property is null
*/
protected String getPropertyText(BaseProperty property)
{
String ret;
BaseProperty property = (BaseProperty) object.safeget(name);
String content;
if (property != null) {
ret = property.toText();
content = property.toText();
} else {
ret = "";
content = "";
}
return ret;
buffer.append(XMLUtils.escapeElementText(content));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,13 @@ public void displayView(StringBuffer buffer, String name, String prefix, BaseCol
buffer.append(result);
}
} else {
String content = getPropertyText((BaseProperty) object.safeget(name));
BaseProperty property = (BaseProperty) object.safeget(name);
String content;
if (property != null) {
content = property.toText();
} else {
content = "";
}

if (doc != null) {
String syntax = getObjectDocumentSyntax(object, context).toIdString();
Expand Down

0 comments on commit 9ad8a79

Please sign in to comment.