Skip to content
Snippets Groups Projects
Commit 0fe39d50 authored by Jan Zickermann's avatar Jan Zickermann
Browse files

OZG-4095 html: Replace ampersands, only

parent 135699b7
No related branches found
No related tags found
1 merge request!12Ozg 4095 abrufen aller nachrichten html
Pipeline #1618 passed
......@@ -3,7 +3,7 @@ package de.ozgcloud.nachrichten.postfach.osiv2.transfer;
public record Osi2HtmlDocument(String html) {
public String renderToPlainText() {
return html.replaceAll("<br/?>", "\n");
return html.replace("&amp;", "&");
}
public static String renderToPlainText(String html) {
......
......@@ -15,9 +15,7 @@ public class V1ReplyMessageTestFactory {
Das ist das Multiline&amp;&lt;b&gt;a&lt;/b&gt<br><br/>
Body""";
public static final String REPLY_BODY = """
Das ist das Multiline&amp;&lt;b&gt;a&lt;/b&gt
Das ist das Multiline&&lt;b&gt;a&lt;/b&gt<br><br/>
Body""";
private static final String DISPLAY_NAME = "Das ist der Absender";
private static final String ORIGIN_SENDER = "das ist der original Sender";
......
......@@ -10,9 +10,9 @@ class Osi2HtmlDocumentTest {
@DisplayName("should render anchor link")
@Test
void shouldRenderAnchorLink() {
var plainText = renderPlainText("<a href=\"https://www.example.com\">Example<br></a><br/>text");
var plainText = renderPlainText("<a href=\"https://www.example.com\">&amp;Example<br></a><br/>text");
assertThat("<a href=\"https://www.example.com\">Example\n</a>\ntext").isEqualTo(plainText);
assertThat("<a href=\"https://www.example.com\">&Example<br></a><br/>text").isEqualTo(plainText);
}
private String renderPlainText(String html) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment