tilboerner / laserchicken

RSS reader web application built on Rails
MIT License
20 stars 3 forks source link

relative href in feed content (entries/view) #19

Open XORwell opened 11 years ago

XORwell commented 11 years ago

github for example is using relative paths in hrefs. as result, Foo starred bar links to laserchicken/bar instead of github/bar

bildschirmfoto 2013-08-14 um 09 42 17

relative links should be replaces with absolutes..

tilboerner commented 11 years ago

Yeah, I noticed that as well. Unfortunately, resolving relative URLs in feeds is not straight forward (see this comment and these specs). On top of that, the github feed doesn't even follow the specs (see XML below), if I read them correctly.

Anyway, as I see it, this is more of a parser issue that rests with Feedzirra. Although it's the most actively developed RSS parser in Ruby, going by their issue tracker I still wouldn't expect them to move very fast on even a pull request.

Outside of the github feeds, I haven't really encountered relative URLs very often. So I propose to just leave them alone for now.

I might be worthwhile, though, to do something with the @links attribute (see below), or make the @url into a more prominent link than a simple "(web)". Suggestions?


Raw XML of @XORwell's example:

  <entry>
    <id>tag:github.com,2008:WatchEvent/1803628246</id>
    <published>2013-08-13T18:06:35Z</published>
    <updated>2013-08-13T18:06:35Z</updated>
    <link type="text/html" rel="alternate" href="https://github.com/inossidabile/sprockets-preload"/>
    <title type="html">XORwell starred inossidabile/sprockets-preload</title>
    <author>
      <name>XORwell</name>
      <uri>https://github.com/XORwell</uri>
    </author>
    <media:thumbnail height="30" width="30" url="https://secure.gravatar.com/avatar/fd7d9314dab1d1272d1c1ed652a2b5a4?s=30&amp;d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"/>
    <content type="html">&lt;!-- watch --&gt;
&lt;div class=&quot;simple&quot;&gt;
  &lt;span class=&quot;octicon octicon-star&quot;&gt;&lt;/span&gt;

  &lt;div class=&quot;title&quot;&gt;
    &lt;a href=&quot;/XORwell&quot;&gt;XORwell&lt;/a&gt; &lt;span&gt;starred&lt;/span&gt; &lt;a href=&quot;/inossidabile/sprockets-preload&quot; class=&quot;css-truncate css-truncate-target&quot;&gt;inossidabile/sprockets-preload&lt;/a&gt;
  &lt;/div&gt;

  &lt;div class=&quot;time&quot;&gt;
    &lt;time class=&quot;js-relative-date&quot; datetime=&quot;2013-08-13T18:06:35Z&quot; title=&quot;2013-08-13 18:06:35&quot;&gt;August 13, 2013&lt;/time&gt;
  &lt;/div&gt;
&lt;/div&gt;
</content>
  </entry>

Entry as returned by Feedzirra parser:

#<Feedzirra::Parser::AtomEntry:0x00000001349b20
  @author="XORwell",
  @content=
   "<!-- watch -->\n<div class=\"simple\">\n  <span class=\"octicon octicon-star\"></span>\n\n  <div class=\"title\">\n    <a href=\"/XORwell\">XORwell</a> <span>starred</span> <a href=\"/inossidabile/sprockets-preload\" class=\"css-truncate css-truncate-target\">inossidabile/sprockets-preload</a>\n  </div>\n\n  <div class=\"time\">\n    <time class=\"js-relative-date\" datetime=\"2013-08-13T18:06:35Z\" title=\"2013-08-13 18:06:35\">August 13, 2013</time>\n  </div>\n</div>\n",
  @entry_id="tag:github.com,2008:WatchEvent/1803628246",
  @links=["https://github.com/inossidabile/sprockets-preload"],
  @published=2013-08-13 18:06:35 UTC,
  @title="XORwell starred inossidabile/sprockets-preload",
  @updated=2013-08-13 18:06:35 UTC,
  @url="https://github.com/inossidabile/sprockets-preload"
#>