mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 08:17:16 +00:00
Pass parsed URL to isGravatarAvatar instead of URL string which then has to be parsed.
This commit is contained in:
1 parent
21543b9ee0
commit
88104fb412
2 files changed
+4
-4
No files matched your search
@@ -29,8 +29,8 @@ enum MediaRSS {
|
||||
private static let gravatarSubdomainSuffix = ".gravatar.com"
|
||||
private static let gravatarAvatarPathPrefix = "/avatar/"
|
||||
|
||||
static func isGravatarAvatar(_ urlString: String) -> Bool {
|
||||
guard let url = URL(string: urlString), let host = url.host()?.lowercased() else {
|
||||
static func isGravatarAvatar(_ url: URL) -> Bool {
|
||||
guard let host = url.host()?.lowercased() else {
|
||||
return false
|
||||
}
|
||||
let isGravatarHost = host == gravatarHost || host.hasSuffix(gravatarSubdomainSuffix)
|
||||
@@ -83,7 +83,7 @@ struct MediaElementTracker {
|
||||
group?.add(attachment, isDefault: MediaRSS.isDefault(attributes))
|
||||
} else {
|
||||
item.attachments.append(attachment)
|
||||
if MediaRSS.isGravatarAvatar(url) {
|
||||
if let parsedURL = URL(string: url), MediaRSS.isGravatarAvatar(parsedURL) {
|
||||
gravatarURL = url
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ private extension SignificantImageFilter {
|
||||
if matches(host: host, path: url.path().lowercased(), blockedImagePrefixes) {
|
||||
return true
|
||||
}
|
||||
return MediaRSS.isGravatarAvatar(urlString)
|
||||
return MediaRSS.isGravatarAvatar(url)
|
||||
}
|
||||
|
||||
/// Includes `mailto:` links, the usual target of an email-this-article button.
|
||||
|
||||
Reference in new issue
Block a user