From ad5070d2b939aac6d6704138e5e45bfaf8f6416e Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Mon, 17 Apr 2023 06:09:36 -0400 Subject: [PATCH] Trim whitespace from webpage titles in StatusCardControl (#1020) --- .../MastodonUI/View/Content/StatusCardControl.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift index dc370811f..90af468b6 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift @@ -138,13 +138,14 @@ public final class StatusCardControl: UIControl { } public func configure(card: Card) { + let title = card.title.trimmingCharacters(in: .whitespacesAndNewlines) if let host = card.url?.host { - accessibilityLabel = "\(card.title) \(host)" + accessibilityLabel = "\(title) \(host)" } else { - accessibilityLabel = card.title + accessibilityLabel = title } - titleLabel.text = card.title + titleLabel.text = title linkLabel.text = card.url?.host imageView.contentMode = .center