Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZCS-10594/TSS-18404: Fix for emails not displaying correctly. #2

Merged
merged 2 commits into from
Jun 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,20 @@ public CleanResults scan(String html) throws ScanException {
@SuppressWarnings("deprecation")
org.apache.xml.serialize.OutputFormat format = getOutputFormat();

//noinspection deprecation
org.apache.xml.serialize.HTMLSerializer serializer = getHTMLSerializer(out, format);
serializer.serialize(dom);

/* Selectively serialize the DocumentFragment only if doesn't
* contain any @ symbol which are media queries causing to
* whatever content is after @ symbol gets stripped off in the
* style tag.
* This is reported and accepted as a bug in the antisamy library #24.
*
*/
if (trimmedHtml.contains("@")) {
log2akshat marked this conversation as resolved.
Show resolved Hide resolved
out = out.append(trimmedHtml);
} else {
log2akshat marked this conversation as resolved.
Show resolved Hide resolved
//noinspection deprecation
org.apache.xml.serialize.HTMLSerializer serializer = getHTMLSerializer(out, format);
serializer.serialize(dom);
}
/*
* Get the String out of the StringWriter and rip out the XML
* declaration if the Policy says we should.
Expand Down