Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added fallback to atom icon when atom logo is missing #221

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions testdata/translator/atom/feed_image_-_atom10_feed_icon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"image": {
"url": "http://example.org/icon.jpg"
},
"items": [],
"feedType": "atom",
"feedVersion": "1.0"
}
6 changes: 6 additions & 0 deletions testdata/translator/atom/feed_image_-_atom10_feed_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!--
Description: feed icon
-->
<feed xmlns="http://www.w3.org/2005/Atom">
<icon>http://example.org/icon.jpg</icon>
</feed>
1 change: 1 addition & 0 deletions testdata/translator/atom/feed_image_-_atom10_feed_logo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Description: feed logo
-->
<feed xmlns="http://www.w3.org/2005/Atom">
<logo>http://example.org/logo.jpg</logo>
<icon>http://example.org/icon.jpg</icon>
</feed>
4 changes: 4 additions & 0 deletions translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,10 @@ func (t *DefaultAtomTranslator) translateFeedImage(atom *atom.Feed) (image *Imag
feedImage := Image{}
feedImage.URL = atom.Logo
image = &feedImage
} else if atom.Icon != "" {
feedImage := Image{}
feedImage.URL = atom.Icon
image = &feedImage
}
return
}
Expand Down
Loading