mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2024-12-22 22:28:35 +01:00
fix: notification not handle escaped HTML tag issue. ticket: #22627CDA
This commit is contained in:
parent
31f178eb3a
commit
1af870a157
@ -56,7 +56,7 @@ class NotificationService: UNNotificationServiceExtension {
|
||||
|
||||
bestAttemptContent.title = notification.title
|
||||
bestAttemptContent.subtitle = ""
|
||||
bestAttemptContent.body = notification.body
|
||||
bestAttemptContent.body = notification.body.escape()
|
||||
bestAttemptContent.sound = UNNotificationSound.init(named: UNNotificationSoundName(rawValue: "BoopSound.caf"))
|
||||
bestAttemptContent.userInfo["plaintext"] = plaintextData
|
||||
|
||||
@ -105,3 +105,14 @@ extension NotificationService {
|
||||
return try? P256.KeyAgreement.PublicKey(x963Representation: publicKeyData)
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
func escape() -> String {
|
||||
return self
|
||||
.replacingOccurrences(of: "&", with: "&")
|
||||
.replacingOccurrences(of: "<", with: "<")
|
||||
.replacingOccurrences(of: ">", with: ">")
|
||||
.replacingOccurrences(of: """, with: "\"")
|
||||
.replacingOccurrences(of: "'", with: "'")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user