ネットサービスの開発に役立ちそうな話題を中心にお届けします。
F.Ko-Jiの「一秒後は未来」 > DailyFeed > DailyFeedで一部のAtomフィードを読み込んだ時にリンク先がおかしくなる不具合を修正しました
2009年05月29日 01:57
981日前に投稿

DailyFeedで一部のAtomフィードを読み込んだ時にリンク先がおかしくなる不具合を修正しました

  • ... PV
  • このエントリーをはてなブックマークに追加

いつも 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;


スポンサード リンク

Written by
Meity.jp - Twitterなかまでプライベートなオフ会を開催したいなら


トラックバック

このエントリーのトラックバックURL:

ネットサービス - DailyFeed / プログラミング

English version

前のエントリー: « Adobeの無料オンラインプレゼン作成ソフト「Acrobat.com Presentations」を試してみた
次のエントリー: 楽天は注文確認メールでショップに注文者のメールアドレスを見せないようにすべき »

コピペにご利用ください。

タイトル:

URL:

リンク用HTMLタグ: