remove jpeg format forcing from avatar download
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -109,19 +109,11 @@ class NotificationService: UNNotificationServiceExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func downloadAvatarImage(from urlString: String) -> INImage? {
|
func downloadAvatarImage(from urlString: String) -> INImage? {
|
||||||
var thumbnailUrlString = urlString.replacingOccurrences(
|
let thumbnailUrlString = urlString.replacingOccurrences(
|
||||||
of: "/img/avatar/",
|
of: "/img/avatar/",
|
||||||
with: "/img/avatar_thumbnail/"
|
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 }
|
guard let url = URL(string: thumbnailUrlString) else { return nil }
|
||||||
|
|
||||||
var request = URLRequest(url: url)
|
var request = URLRequest(url: url)
|
||||||
|
|||||||
Reference in New Issue
Block a user