rome
  1. rome
  2. ROME-123

Yahoo MediaRSS <media:content/> can't handle URLs with spaces

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      123

      Description

      Some feeds contains url attributes that aren't valid URIs. The current code
      expects the url attribute to be a URI, even though the spec doesn't mention URIs
      in this context.

      Test and patch below.

      Index:
      subprojects/modules/mediarss/src/java/com/sun/syndication/feed/module/mediarss/io/MediaModuleParser.java
      ===================================================================
      RCS file:
      /cvs/rome/subprojects/modules/mediarss/src/java/com/sun/syndication/feed/module/mediarss/io/MediaModuleParser.java,v
      retrieving revision 1.12
      diff -u -r1.12 MediaModuleParser.java

      subprojects/modules/mediarss/src/java/com/sun/syndication/feed/module/mediarss/io/MediaModuleParser.java
      7 Jan 2009 22:54:47 -0000 1.12
      +++
      subprojects/modules/mediarss/src/java/com/sun/syndication/feed/module/mediarss/io/MediaModuleParser.java
      25 Feb 2009 15:58:34 -0000
      @@ -43,6 +43,7 @@
      import com.sun.syndication.io.impl.NumberParser;

      import java.net.URI;
      +import java.net.URL;

      import org.jdom.Element;
      import org.jdom.Namespace;
      @@ -112,7 +113,7 @@
      if (content.getAttributeValue("url") != null) {
      try

      { mc = new MediaContent(new UrlReference( - new URI(content.getAttributeValue("url")))); + new URL(content.getAttributeValue("url")).toURI())); mc.setPlayer(parsePlayer(content)); }

      catch (Exception ex)

      { LOG.log(Level.WARNING, "Exception parsing content tag.", ex); Index: subprojects/modules/mediarss/src/test/com/sun/syndication/feed/module/mediarss/MediaModuleTest.java =================================================================== RCS file: /cvs/rome/subprojects/modules/mediarss/src/test/com/sun/syndication/feed/module/mediarss/MediaModuleTest.java,v retrieving revision 1.6 diff -u -r1.6 MediaModuleTest.java --- subprojects/modules/mediarss/src/test/com/sun/syndication/feed/module/mediarss/MediaModuleTest.java 7 Dec 2006 00:25:40 -0000 1.6 +++ subprojects/modules/mediarss/src/test/com/sun/syndication/feed/module/mediarss/MediaModuleTest.java 25 Feb 2009 15:58:34 -0000 @@ -16,6 +16,7 @@ import java.io.BufferedWriter; import java.io.FileWriter; import java.io.InputStreamReader; +import java.io.StringReader; import java.net.URL; import java.util.Iterator; import java.util.List; @@ -74,6 +75,26 @@ }

      }

      + public void testParseMediaContentContainingURLWithSpaces() throws Exception

      { + SyndFeedInput input = new SyndFeedInput(); + SyndFeed feed = input.build(new StringReader( + "<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss/\">" + + "<channel>" + + "<title>My Movie Review Site</title>" + + "<link>http://www.foo.com</link>" + + "<description>I review movies.</description>" + + "<item>" + + "<title>Movie Title: Is this a good movie?</title>" + + "<link>http://www.foo.com/item1.htm</link>" + + "<media:content url=\"http://www.foo.com/path/containing spaces/trailer.mov\"" + +"fileSize=\"12216320\" type=\"video/quicktime\" expression=\"sample\"/>" + + "</item>" + + "</channel>" + + "</rss>")); + + SyndEntry entry = (SyndEntry) feed.getEntries().get(0); + MediaEntryModule m = (MediaEntryModule) entry.getModule(MediaEntryModule.URI ); + }

      /** This code represents the original MediaModuleTest main class from
      openvision.tv
      */

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            rome-issues
            Reporter:
            jabley
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: