Handle media source validation more gracefully. (#3571)

* Handle media source validation more gracefully.

* Fix unit tests.
This commit is contained in:
Doug
2024-11-29 12:42:27 +00:00
committed by GitHub
parent c8627cfd64
commit 49a94e0bdb
13 changed files with 95 additions and 90 deletions
@@ -55,7 +55,7 @@ struct NotificationItemProxy: NotificationItemProxyProtocol {
var senderAvatarMediaSource: MediaSourceProxy? {
if let senderAvatarURLString = notificationItem.senderInfo.avatarUrl,
let senderAvatarURL = URL(string: senderAvatarURLString) {
return MediaSourceProxy(url: senderAvatarURL, mimeType: nil)
return try? MediaSourceProxy(url: senderAvatarURL, mimeType: nil)
}
return nil
}
@@ -63,7 +63,7 @@ struct NotificationItemProxy: NotificationItemProxyProtocol {
var roomAvatarMediaSource: MediaSourceProxy? {
if let roomAvatarURLString = notificationItem.roomInfo.avatarUrl,
let roomAvatarURL = URL(string: roomAvatarURLString) {
return MediaSourceProxy(url: roomAvatarURL, mimeType: nil)
return try? MediaSourceProxy(url: roomAvatarURL, mimeType: nil)
}
return nil
}