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-12002:failed test case of testBug64974 #1393

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
20 changes: 12 additions & 8 deletions store/src/java/com/zimbra/cs/html/owasp/OwaspHtmlSanitizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,19 @@ private String checkUnbalancedTags(String html) {
String start = tagArr[0];
String end = tagArr[1];
String[] arrOfStr = html.split(start);
for (String strAfterSplit : arrOfStr) {
if (!strAfterSplit.equals("") && strAfterSplit.contains(end)) {
formattedHtml = formattedHtml + start + strAfterSplit;
} else {
formattedHtml = formattedHtml + strAfterSplit;
}
//ZCS-12002 ( failed test case for testBug64974 )
//if the html doesn't containing start then skipping other operations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add space after //

if (arrOfStr.length > 1) {
for (String strAfterSplit : arrOfStr) {
if (!strAfterSplit.equals("") && strAfterSplit.contains(end)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For safety reasons (and avoiding a NullPoitnerException), you should compare the literal string to the variable.

!strAfterSpit.equals("")

should be:

!"".equals(strAfterSpit)

formattedHtml = formattedHtml + start + strAfterSplit;
} else {
formattedHtml = formattedHtml + strAfterSplit;
}
}
html = formattedHtml;
formattedHtml = "";
}
html = formattedHtml;
formattedHtml = "";
}
return html;
}
Expand Down