-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3834 from coralproject/hotfix/6.16.2
- Fix terser webpack plugin memory leak (#3832) - Fix how links are handled in comments (#3828) - Fix flatten replies admin toggle not showing flatten replies working in stream (#3834)
- Loading branch information
Showing
9 changed files
with
78,446 additions
and
957 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,6 +89,22 @@ it("sanitizes without features enabled", () => { | |
`); | ||
}); | ||
|
||
it("allows mailto links", () => { | ||
const sanitize = createSanitize(window as any); | ||
expect(sanitize('<a href="mailto:[email protected]">[email protected]</a>')) | ||
.toMatchInlineSnapshot(` | ||
<body> | ||
<a | ||
href="mailto:[email protected]" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
[email protected] | ||
</a> | ||
</body> | ||
`); | ||
}); | ||
|
||
it("replaces anchor tags with their text", () => { | ||
const sanitize = createSanitize(window as any); | ||
const el = sanitize( | ||
|
@@ -98,15 +114,49 @@ it("replaces anchor tags with their text", () => { | |
</div> | ||
` | ||
); | ||
expect(el.innerHTML).toMatchInlineSnapshot( | ||
` | ||
expect(el.innerHTML).toMatchInlineSnapshot(` | ||
" | ||
<div> | ||
This is a link. This is another link with no href in a comment. | ||
</div> | ||
" | ||
`); | ||
}); | ||
|
||
it("does not replace anchor tags with their text if href does match inner html", () => { | ||
const sanitize = createSanitize(window as any); | ||
const el = sanitize( | ||
` | ||
<div> | ||
This is a link where href matches <a href="http://test.com">http://test.com</a>. | ||
</div> | ||
` | ||
); | ||
expect(el.innerHTML).toMatchInlineSnapshot(` | ||
" | ||
<div> | ||
This is a link where href matches <a href=\\"http://test.com\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">http://test.com</a>. | ||
</div> | ||
" | ||
`); | ||
}); | ||
|
||
it("does not replace anchor tags with their text if href does match inner html and only one has a trailing slash", () => { | ||
const sanitize = createSanitize(window as any); | ||
const el = sanitize( | ||
` | ||
<div> | ||
This is a link where href matches <a href="http://test.com/">http://test.com</a>. | ||
</div> | ||
` | ||
); | ||
expect(el.innerHTML).toMatchInlineSnapshot(` | ||
" | ||
<div> | ||
This is a link where href matches <a href=\\"http://test.com/\\" target=\\"_blank\\" rel=\\"noopener noreferrer\\">http://test.com</a>. | ||
</div> | ||
" | ||
`); | ||
}); | ||
|
||
it("allows bolded tags", () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters