remove jpeg format forcing from avatar download

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-04-22 13:13:53 +03:00
parent b9dbdb2250
commit 02ca0516ab
+1 -9
View File
@@ -109,19 +109,11 @@ class NotificationService: UNNotificationServiceExtension {
}
func downloadAvatarImage(from urlString: String) -> INImage? {
var thumbnailUrlString = urlString.replacingOccurrences(
let thumbnailUrlString = urlString.replacingOccurrences(
of: "/img/avatar/",
with: "/img/avatar_thumbnail/"
)
// CDN URLs may end with @webp or no extension (which defaults to webp).
// INImage doesn't reliably handle WebP, so force JPEG.
if let atRange = thumbnailUrlString.range(of: "@", options: .backwards) {
thumbnailUrlString = String(thumbnailUrlString[..<atRange.lowerBound]) + "@jpeg"
} else {
thumbnailUrlString += "@jpeg"
}
guard let url = URL(string: thumbnailUrlString) else { return nil }
var request = URLRequest(url: url)