mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-01-10 16:22:59 +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.title = notification.title
|
||||||
bestAttemptContent.subtitle = ""
|
bestAttemptContent.subtitle = ""
|
||||||
bestAttemptContent.body = notification.body
|
bestAttemptContent.body = notification.body.escape()
|
||||||
bestAttemptContent.sound = UNNotificationSound.init(named: UNNotificationSoundName(rawValue: "BoopSound.caf"))
|
bestAttemptContent.sound = UNNotificationSound.init(named: UNNotificationSoundName(rawValue: "BoopSound.caf"))
|
||||||
bestAttemptContent.userInfo["plaintext"] = plaintextData
|
bestAttemptContent.userInfo["plaintext"] = plaintextData
|
||||||
|
|
||||||
@ -105,3 +105,14 @@ extension NotificationService {
|
|||||||
return try? P256.KeyAgreement.PublicKey(x963Representation: publicKeyData)
|
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