diff --git a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift
index 80fb8419c..8d4bc9bf3 100644
--- a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift
+++ b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift
@@ -40,7 +40,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
private let cacheKey: String
private let mentionBuilder: MentionBuilderProtocol
- private static let attributeMSC4286 = "data-msc4286-external-payment-details"
+ private static let attributeMSC4286 = "msc4286-external-payment-details"
private static let cacheDispatchQueue = DispatchQueue(label: "io.element.elementx.attributed_string_builder_v2_cache")
private static var caches: [String: LRUCache] = [:]
@@ -225,7 +225,7 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
}
case "span":
- if childElement.dataset()[Self.attributeMSC4286] != nil {
+ if childElement.dataset()[Self.attributeMSC4286] == nil {
content = attributedString(element: childElement, documentBody: documentBody, preserveFormatting: preserveFormatting, listTag: listTag, listIndex: &childIndex, indentLevel: indentLevel)
}
diff --git a/UnitTests/Sources/AttributedStringBuilderTests.swift b/UnitTests/Sources/AttributedStringBuilderTests.swift
index d561b721a..79fca3ddc 100644
--- a/UnitTests/Sources/AttributedStringBuilderTests.swift
+++ b/UnitTests/Sources/AttributedStringBuilderTests.swift
@@ -1016,19 +1016,33 @@ class AttributedStringBuilderTests: XCTestCase {
}
func testMxExternalPaymentDetailsRemoved() {
- let htmlString = "This is visible. But text is hidden and this link too"
+ var htmlString = "This is visible. But this is hidden and this link too"
guard let attributedString = attributedStringBuilder.fromHTML(htmlString) else {
XCTFail("Could not build the attributed string")
return
}
- XCTAssertEqual(String(attributedString.characters), "This is visible")
+ XCTAssertEqual(String(attributedString.characters), "This is visible.")
for run in attributedString.runs where run.link != nil {
XCTFail("No link expected, but found one")
return
}
+
+ htmlString = "This is visible. And this text and link are visible too."
+
+ guard let attributedString = attributedStringBuilder.fromHTML(htmlString) else {
+ XCTFail("Could not build the attributed string")
+ return
+ }
+
+ XCTAssertEqual(String(attributedString.characters), "This is visible. And this text and link are visible too.")
+
+ guard attributedString.runs.first(where: { $0.link != nil })?.link != nil else {
+ XCTFail("Couldn't find the link")
+ return
+ }
}
// MARK: - Private