Handle < in title that is not used as beginning of HTML tag.

This commit is contained in:
Brent Simmons committed 2026-07-04 17:26:43 -07:00
1 parent 3a948b7556
commit de464b6a34
3 files changed
+49 -12

No files matched your search

@@ -109,4 +109,14 @@ import UIKit
XCTAssertEqual(s.string, "[NSFW]")
}
// #4742: a title with a literal `<` followed by non-tag text must
// render in full in the timeline — not truncated at the `<`, and with
// no spurious trailing `>`.
func testLiteralLessThanTitleIsNotTruncated() {
let input = "No place in children's hands: <16s in UK to be banned"
let sanitized = ArticleStringFormatter.sanitizedTitle(input, forHTML: true)!
let s = NSAttributedString(simpleHTML: sanitized)
XCTAssertEqual(s.string, "No place in children's hands: <16s in UK to be banned")
}
}