New issue 57 by flu...@beesbuzz.biz: Relative image links not being
rewritten
http://code.google.com/p/feed-on-feeds/issues/detail?id=57
Some comics' RSS feeds (such as Dumm Comics) use relative paths to their
images' SRC and links' HREF attributes. While this is technically an error
in the RSS feed (since feeds are supposed to be portable), other readers
(notably Google Reader) rewrite the relative paths, which helps prevent the
problem.
For whatever it's worth, for my own RSS feeds I have written a function
"rewriteRelative" which fixes relative paths; perhaps it would be useful to
integrate it into FonF:
// Rewrite all relative links in a chunk of HTML/XML/etc. to point to the
appropriate place
function rewriteRelative($html, $base) {
// generate server-only replacement for root-relative URLs
$server = preg_replace('@^([^\:]*)://([^/*]*)(/|$).*@', '\1://\2/',
$base);
// replace root-relative URLs
$html = preg_replace('@\<([^>]*) (href|src)="/([^"]*)"@i',
'<\1 \2="' . $server . '\3"', $html);
// replace base-relative URLs (kludgy, but I couldn't get ! to work)
$html = preg_replace('@\<([^>]*)
(href|src)="(([^\:"])*|([^"]*:[^/"].*))"@i',
'<\1 \2="' . $base . '\3"', $html);
return $html;
}
It's a little kludgy but it does the job.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
Yeah, that's definitely the case. Feel free to close this ticket. Sorry for
the
inconvenience.