From 4fe902a5d2d35c3914b8000efe59ff66a74fc957 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 29 Feb 2024 00:28:54 +0100 Subject: [PATCH] =?UTF-8?q?Use=20`strings.EqualFold`=20instead=20of=20`str?= =?UTF-8?q?ings.ToLower(=E2=80=A6)=20=3D=3D`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/reader/atom/atom_10.go | 2 +- internal/reader/atom/atom_common.go | 8 ++++---- internal/urllib/url.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/reader/atom/atom_10.go b/internal/reader/atom/atom_10.go index afcb127d..5b67e073 100644 --- a/internal/reader/atom/atom_10.go +++ b/internal/reader/atom/atom_10.go @@ -184,7 +184,7 @@ func (a *atom10Entry) entryEnclosures() model.EnclosureList { } for _, link := range a.Links { - if strings.ToLower(link.Rel) == "enclosure" { + if strings.EqualFold(link.Rel, "enclosure") { if link.URL == "" { continue } diff --git a/internal/reader/atom/atom_common.go b/internal/reader/atom/atom_common.go index 6909747a..4b283d44 100644 --- a/internal/reader/atom/atom_common.go +++ b/internal/reader/atom/atom_common.go @@ -46,7 +46,7 @@ type atomLinks []*atomLink func (a atomLinks) originalLink() string { for _, link := range a { - if strings.ToLower(link.Rel) == "alternate" { + if strings.EqualFold(link.Rel, "alternate") { return strings.TrimSpace(link.URL) } @@ -60,7 +60,7 @@ func (a atomLinks) originalLink() string { func (a atomLinks) firstLinkWithRelation(relation string) string { for _, link := range a { - if strings.ToLower(link.Rel) == relation { + if strings.EqualFold(link.Rel, relation) { return strings.TrimSpace(link.URL) } } @@ -70,9 +70,9 @@ func (a atomLinks) firstLinkWithRelation(relation string) string { func (a atomLinks) firstLinkWithRelationAndType(relation string, contentTypes ...string) string { for _, link := range a { - if strings.ToLower(link.Rel) == relation { + if strings.EqualFold(link.Rel, relation) { for _, contentType := range contentTypes { - if strings.ToLower(link.Type) == contentType { + if strings.EqualFold(link.Type, contentType) { return strings.TrimSpace(link.URL) } } diff --git a/internal/urllib/url.go b/internal/urllib/url.go index b3e2a546..55230187 100644 --- a/internal/urllib/url.go +++ b/internal/urllib/url.go @@ -67,7 +67,7 @@ func IsHTTPS(websiteURL string) bool { return false } - return strings.ToLower(parsedURL.Scheme) == "https" + return strings.EqualFold(parsedURL.Scheme, "https") } // Domain returns only the domain part of the given URL.