Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit e569d58

Browse files
Merge pull request SORMAS-Foundation#3402 from ImisDevelopers/bugfix-3193-eventaction-html
[IMIS] Fix SORMAS-Foundation#3193 to re-enable html styling for event actions
2 parents 8891837 + 76f6d0c commit e569d58

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

sormas-ui/src/main/java/de/symeda/sormas/ui/action/ActionListEntry.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
*******************************************************************************/
1818
package de.symeda.sormas.ui.action;
1919

20+
import org.jsoup.Jsoup;
21+
import org.jsoup.safety.Whitelist;
22+
2023
import com.google.common.base.MoreObjects;
2124
import com.google.common.base.Strings;
2225
import com.vaadin.icons.VaadinIcons;
@@ -37,7 +40,6 @@
3740
import de.symeda.sormas.ui.utils.ButtonHelper;
3841
import de.symeda.sormas.ui.utils.CssStyles;
3942
import de.symeda.sormas.ui.utils.DateFormatHelper;
40-
import org.apache.commons.text.StringEscapeUtils;
4143

4244
@SuppressWarnings("serial")
4345
public class ActionListEntry extends HorizontalLayout {
@@ -78,11 +80,15 @@ public ActionListEntry(ActionDto action) {
7880
descReplyLayout.addStyleName(CssStyles.RICH_TEXT_CONTENT_CONTAINER);
7981
withContentLayout.addComponents(descReplyLayout);
8082

81-
Label description = new Label(StringEscapeUtils.escapeHtml4(action.getDescription()), ContentMode.HTML);
83+
Whitelist whitelist = Whitelist.relaxed();
84+
whitelist.addTags("hr", "font");
85+
whitelist.addAttributes("font", "size", "face", "color");
86+
whitelist.addAttributes("div", "align");
87+
Label description = new Label(Jsoup.clean(action.getDescription(), whitelist), ContentMode.HTML);
8288
description.setWidth(100, Unit.PERCENTAGE);
8389
descReplyLayout.addComponent(description);
8490
if (!Strings.isNullOrEmpty(action.getReply())) {
85-
Label replyLabel = new Label(StringEscapeUtils.escapeHtml4(action.getReply()), ContentMode.HTML);
91+
Label replyLabel = new Label(Jsoup.clean(action.getReply(), whitelist), ContentMode.HTML);
8692
replyLabel.setWidth(100, Unit.PERCENTAGE);
8793
replyLabel.addStyleName(CssStyles.REPLY);
8894
descReplyLayout.addComponent(replyLabel);

0 commit comments

Comments
 (0)