DailyFeedで一部のAtomフィードを読み込んだ時にリンク先がおかしくなる不具合を修正しました
いつも DailyFeed をご利用いただきありがとうございます。
一部のAtomフィードを読み込んでDailyFeedを作成したとき、ひとつのリンク先URLに複数のURLが連結されてしまう不具合がありましたので、さきほど修正しました。
原因としては、フィードのパースに利用している MagpieRSS が Atom の link 要素を適当に取り扱っていたためです。
そのままだと channel 要素に含まれる link 要素も entry 要素に含まれる link 要素も source 要素に含まれる link 要素も同等に取り扱ってしまっていて、おかしなことになっていました。
参考までに修正内容の diff を載せておきます。
+++ extlib/magpierss/rss_parse.inc (working copy)
@@ -61,6 +61,7 @@
var $intextinput = false;
var $inimage = false;
var $current_namespace = false;
+ var $insource = false;
/**
@@ -187,6 +188,9 @@
$this->current_item['about'] = $attrs['rdf:about'];
}
}
+ elseif ($this->initem and $el == 'source') {
+ $this->insource = true;
+ }
// if we're in the default namespace of an RSS feed,
// record textinput or image fields
@@ -237,7 +241,7 @@
// Magpie treats link elements of type rel='alternate'
// as being equivalent to RSS's simple link element.
//
- elseif ($this->feed_type == ATOM and $el == 'link' )
+ elseif ($this->feed_type == ATOM and $el == 'link' and $this->initem and !$this->insource)
{
if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
{
@@ -277,6 +281,9 @@
$this->current_item = array();
$this->initem = false;
}
+ elseif ($el == 'source' and $this->initem) {
+ $this->insource = false;
+ }
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
{
$this->intextinput = false;
コメントを残す