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

Don't create an empty <summary> in Atom feeds #83

Merged
merged 3 commits into from
Aug 17, 2023

Conversation

magical
Copy link
Contributor

@magical magical commented Aug 18, 2020

When creating an AtomEntry from an Item, only set Summary if
item.Description is non-empty, like we already do for Content.

Currently we always emit a <summary> element, even if the item has a
non-empty <content> element. Having an empty <summary> in this case may
be confusing for feed consumers.

The Atom RFC explicitly says that a <summary> is not required in general.
(There are a couple special cases where it is required, but they aren't
relevant here.)

https://tools.ietf.org/html/rfc4287#section-4.1.1.1

Fixes #82

When creating an AtomEntry from an Item, only set Summary if
item.Description is non-empty, like we already do for Content.

Currently we always emit a <summary> element, even if the item has a
non-empty <content> element. Having an empty <summary> in this case may
be confusing for feed consumers.

The Atom RFC explicitly says that a <summary> is not required in general.
(There are a couple special cases where it is required, but they aren't
relevant here.)

https://tools.ietf.org/html/rfc4287#section-4.1.1.1

Fixes gorilla#82
@magical
Copy link
Contributor Author

magical commented Aug 26, 2020

ping @elithrar

@stale
Copy link

stale bot commented Nov 1, 2020

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

@stale stale bot added the stale label Nov 1, 2020
@magical
Copy link
Contributor Author

magical commented Nov 1, 2020

Not stale.

@stale stale bot removed the stale label Nov 1, 2020
@stale
Copy link

stale bot commented Jan 3, 2021

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

@stale stale bot added the stale label Jan 3, 2021
@magical
Copy link
Contributor Author

magical commented Jan 3, 2021

Still not stale.

@stale stale bot removed the stale label Jan 3, 2021
@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

@stale stale bot added the stale label Jun 2, 2021
@magical
Copy link
Contributor Author

magical commented Jun 2, 2021

Poke

@stale stale bot removed the stale label Jun 2, 2021
@stale
Copy link

stale bot commented Aug 22, 2021

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

@stale stale bot added the stale label Aug 22, 2021
@magical
Copy link
Contributor Author

magical commented Aug 22, 2021

Bump

@stale stale bot removed the stale label Aug 22, 2021
@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

@stale stale bot added the stale label Jan 9, 2022
@magical
Copy link
Contributor Author

magical commented Jan 15, 2022

poke

@stale stale bot removed the stale label Jan 15, 2022
@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.

@stale stale bot added the stale label Apr 16, 2022
@magical
Copy link
Contributor Author

magical commented Apr 16, 2022

👋

@stale stale bot removed the stale label Apr 16, 2022
@glacials
Copy link

The Atom RFC explicitly says that a <summary> is not required in general.
(There are a couple special cases where it is required, but they aren't
relevant here.)

This one seems maybe relevant, since the consumer can set the Type:

atom:entry elements MUST contain an atom:summary element in either
of the following cases:
...

  • the atom:entry contains content that is encoded in Base64; i.e., the "type" attribute of atom:content is a MIME media type [MIMEREG], but is not an XML media type [RFC3023], does not begin with "text/", and does not end with "/xml" or "+xml".

Copy link

@amustaque97 amustaque97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making that change. Also kudos for your effort to keep commenting on both issue and PR to avoid staleness.

cc @elithrar, merge this PR.

@FelicianoTech
Copy link

FelicianoTech commented Jul 9, 2023

Hey @magical,

In case you haven't seen, Gorilla has abandoned all of their projects. There is a note about it on the readme. I needed a library like this and after some research, this one seemed to fit the build even though it is abandoned. I have forked the project and it can be found here: https://github.com/gopherlibs/feedhub

I would appreciate it if you were willing to recreate this PR over at my fork. Having looked at the PR here, I am confident we can get it merged into my fork.

p.s. You snagged the GitHub username magical? Nice.

@codecov
Copy link

codecov bot commented Jul 30, 2023

Codecov Report

Merging #83 (e9a32b9) into main (07a4f17) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #83   +/-   ##
=======================================
  Coverage   79.18%   79.18%           
=======================================
  Files           5        5           
  Lines         269      269           
=======================================
  Hits          213      213           
  Misses         48       48           
  Partials        8        8           
Files Changed Coverage Δ
atom.go 92.42% <100.00%> (ø)

@coreydaley coreydaley enabled auto-merge (squash) August 17, 2023 01:29
@coreydaley coreydaley merged commit 8b1dc44 into gorilla:main Aug 17, 2023
@magical
Copy link
Contributor Author

magical commented Aug 17, 2023

@coreydaley Thanks!

Bios-Marcel pushed a commit to Bios-Marcel/feeds that referenced this pull request Apr 27, 2024
When creating an AtomEntry from an Item, only set Summary if
item.Description is non-empty, like we already do for Content.

Currently we always emit a `<summary>` element, even if the item has a
non-empty `<content>` element. Having an empty `<summary>` in this case
may
be confusing for feed consumers.

The Atom RFC explicitly says that a `<summary>` is not required in
general.
(There are a couple special cases where it is required, but they aren't
relevant here.)

https://tools.ietf.org/html/rfc4287#section-4.1.1.1

Fixes gorilla#82

Co-authored-by: Corey Daley <cdaley@redhat.com>
jlelse pushed a commit to jlelse/feeds that referenced this pull request Dec 19, 2024
When creating an AtomEntry from an Item, only set Summary if
item.Description is non-empty, like we already do for Content.

Currently we always emit a `<summary>` element, even if the item has a
non-empty `<content>` element. Having an empty `<summary>` in this case
may
be confusing for feed consumers.

The Atom RFC explicitly says that a `<summary>` is not required in
general.
(There are a couple special cases where it is required, but they aren't
relevant here.)

https://tools.ietf.org/html/rfc4287#section-4.1.1.1

Fixes gorilla#82

Co-authored-by: Corey Daley <cdaley@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Spurious empty <summary> elements in atom feed
6 participants