Ticket #1464 (closed defect (bug): fixed)

Opened 7 years ago

Last modified 5 years ago

wp-atom.php produces invalid enclosure

Reported by: raster Owned by: rob1n
Priority: normal Milestone: 2.2
Component: General Version: 2.1
Severity: normal Keywords: has-patch commit
Cc: dougal

Description

In wp-atom.php there is a call to rss_enclosure, so when an enclosure is added to a post, it outputs an enclosure element, which is invalid accoring to feedvalidator.org

Possible fix: A function like atom_enclosure could be added that would output either something like this: <content type="audio/mpeg" src=" http://foo.com/foo.mp3" /> or this: <link rel="related" type="audio/mpeg" href=" http://foo.com/foo.mp3" /> instead of RSS 2.0's enclosure element.

Attachments

1464.diff Download (1.4 KB) - added by rob1n 5 years ago.
1464.2.diff Download (2.2 KB) - added by rob1n 5 years ago.

Change History

  • Keywords atom enclosures podcasting videoblogging added

There may not be a good solution for Atom 0.3, meaning aggregator support for enclosures in Atom 0.3 is not a standard feature. While support in aggregators may not be standard, this could be used: <link rel="related" type="audio/mpeg" href=" http://foo.com/foo.mp3" /> as it does validate, which is probably better than not validating.

  • Keywords needs-patch added; atom enclosures podcasting videoblogging removed
  • Owner changed from anonymous to rob1n
  • Version changed from 1.5.1.2 to 2.1
  • Status changed from new to assigned
  • Milestone set to 2.2

2.2 currently still calls rss_enclosure() for the Atom enclosure.

 http://atomenabled.org/developers/syndication/#link

<link rel="enclosure">. Working on patch.

  • Summary changed from wp-atom.php produces invalid output to wp-atom.php produces invalid enclosure

rob1n5 years ago

  • Keywords has-patch added; needs-patch removed

Patch added that includes a new function (atom_enclosure), and replaces the call to rss_enclosure() in wp-atom.php with atom_enclosure().

comment:6   ryan5 years ago

  • Cc dougal added

comment:7   ryan5 years ago

I'll ping dougal for his input.

Is the if ( is_array($val) ) really necessary, since you cast to an array in the foreach?

Also, it's missing a closing curly brace at the end.

Other than that, and the fact that we've moved the feed generation code under wp-includes recently, it appears to be fine.

  • Keywords has-patch removed

Heh, I just copied the code from rss_enclosure() and made it Atom-specific. I'll make a new patch.

rob1n5 years ago

  • Keywords has-patch commit added

Okay, new patch is (hopefully) final. I also took the liberty of rewriting rss_enclosure(), as that code made no sense whatsoever.

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [4930]) Proper atom enclosures. Props rob1n. fixes #1464

Note: See TracTickets for help on using tickets.