mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
refactor(icon): avoid calling AbsoluteURL
twice for the feed icon URL
The url of a feed's icon is always absolute.
This commit is contained in:
parent
9d32b23ab0
commit
2a372674a2
1 changed files with 2 additions and 16 deletions
|
@ -53,8 +53,8 @@ func (f *iconFinder) findIcon() (*model.Icon, error) {
|
|||
)
|
||||
|
||||
if f.feedIconURL != "" {
|
||||
if icon, err := f.fetchFeedIcon(); err != nil {
|
||||
slog.Debug("Unable to download icon from feed",
|
||||
if icon, err := f.downloadIcon(f.feedIconURL); err != nil {
|
||||
slog.Debug("Unable to fetch the feed's icon",
|
||||
slog.String("website_url", f.websiteURL),
|
||||
slog.String("feed_icon_url", f.feedIconURL),
|
||||
slog.Any("error", err),
|
||||
|
@ -94,20 +94,6 @@ func (f *iconFinder) fetchDefaultIcon() (*model.Icon, error) {
|
|||
return icon, nil
|
||||
}
|
||||
|
||||
func (f *iconFinder) fetchFeedIcon() (*model.Icon, error) {
|
||||
slog.Debug("Fetching feed icon",
|
||||
slog.String("website_url", f.websiteURL),
|
||||
slog.String("feed_icon_url", f.feedIconURL),
|
||||
)
|
||||
|
||||
iconURL, err := urllib.AbsoluteURL(f.websiteURL, f.feedIconURL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(`icon: unable to convert icon URL to absolute URL: %w`, err)
|
||||
}
|
||||
|
||||
return f.downloadIcon(iconURL)
|
||||
}
|
||||
|
||||
func (f *iconFinder) fetchIconsFromHTMLDocument() (*model.Icon, error) {
|
||||
slog.Debug("Searching icons from HTML document",
|
||||
slog.String("website_url", f.websiteURL),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue