Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10672 (closed defect: fixed)

Opened 5 months ago

Last modified 2 months ago

[PATCH] AtomFeedHelper produces invalid feeds

Reported by: xaviershay Assigned to: technoweenie
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords: patch
Cc:

Description

This patch addresses the following defects:

1. The tags created do not contain a date

Fails http://feedvalidator.org/docs/error/InvalidTAG.html

You can now provide a schema_date option to atom_feed. A warning is issued if this is not provided, as a default cannot be obtained otherwise.

2. IDs are not guaranteed unique

Separators were being stripped from tag IDs (both feed and entry), meaning that the following feeds would have the same ID:

/foo/bar
/foobar

/foo/11
/foo1/1

3. A default self link was not provided, contrary to the documentation

Docs say ":url - The URL for this feed. Defaults to the current URL." This was not the case - no default was added to the feed.

Compatibility Issues

This patch will change tag IDs for existing feeds using this helper. That's a Bad Thing, but it is the lesser of two evils - it is more important to make the feeds valid.

Attachments

atom_feed_helper_produces_invalid_feeds_fix_r8521.diff (6.3 kB) - added by xaviershay on 01/02/08 11:52:32.

Change History

01/02/08 11:52:32 changed by xaviershay

  • attachment atom_feed_helper_produces_invalid_feeds_fix_r8521.diff added.

01/02/08 11:54:42 changed by xaviershay

One thing I missed:

4. Blocks are not passed through to XmlBuilder

You can now have a top level author block. The following works as expected:

atom_feed(:schema_date => '2008') do |feed|
  feed.author do |author|
    author.name("Xavier Shay")
  end
end

01/02/08 19:34:29 changed by technoweenie

  • owner changed from core to technoweenie.
  • status changed from new to assigned.

This doesn't apply at all... What are you modifying exactly? Did you move some files around? It looks like you moved atom_feed_helper.rb to lib/action_view/helpers, and the test to test/templates. Even after doing that, the patch failed 8 out of 9 hunks. Maybe there's a newer version of the plugin i'm not seeing?

01/02/08 19:37:59 changed by technoweenie

Hey, brynary just informed me that it's in core now. nevermind :)

01/02/08 19:45:57 changed by rick

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [8529]) Fix atom_feed_helper to comply with the atom spec. Closes #10672 [xaviershay]

03/17/08 04:46:35 changed by david

(In [9044]) Fixed that atom_feed shouldnt require a schema_date since most people just dont care and the value tends to be of no significance anyway (references #10672) [DHH]