]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Copy isset($attachment->filename) fix from RSS 1.0 to RSS 2.0 and Atom 1.0 feeds.
authorToby Inkster <mail@tobyinkster.co.uk>
Mon, 13 Jul 2009 15:56:52 +0000 (16:56 +0100)
committerToby Inkster <mail@tobyinkster.co.uk>
Mon, 13 Jul 2009 15:56:52 +0000 (16:56 +0100)
classes/Notice.php
lib/twitterapi.php

index 75044cf638ae1b5218a08863ceed01f2a59a4191..fc28f355882c3445932470e0d7a366830e7a2935 100644 (file)
@@ -1170,11 +1170,13 @@ class Notice extends Memcached_DataObject
         $attachments = $this->attachments();
         if($attachments){
             foreach($attachments as $attachment){
-                $attributes = array('rel'=>'enclosure','href'=>$attachment->url,'type'=>$attachment->mimetype,'length'=>$attachment->size);
-                if($attachment->title){
-                    $attributes['title']=$attachment->title;
+                if (isset($attachment->filename)) {
+                    $attributes = array('rel'=>'enclosure','href'=>$attachment->url,'type'=>$attachment->mimetype,'length'=>$attachment->size);
+                    if($attachment->title){
+                        $attributes['title']=$attachment->title;
+                    }
+                    $xs->element('link', $attributes, null);
                 }
-                $xs->element('link', $attributes, null);
             }
         }
 
index 4f3a5c0b6f0e4fdb9fc13160cc5662c2085330c2..ce188e00d896b3347e034a14191f72da3333f349 100644 (file)
@@ -218,11 +218,13 @@ class TwitterapiAction extends Action
         if($attachments){
             $entry['enclosures']=array();
             foreach($attachments as $attachment){
-                $enclosure=array();
-                $enclosure['url']=$attachment->url;
-                $enclosure['mimetype']=$attachment->mimetype;
-                $enclosure['size']=$attachment->size;
-                $entry['enclosures'][]=$enclosure;
+                if (isset($attachment->filename)) {
+                    $enclosure=array();
+                    $enclosure['url']=$attachment->url;
+                    $enclosure['mimetype']=$attachment->mimetype;
+                    $enclosure['size']=$attachment->size;
+                    $entry['enclosures'][]=$enclosure;
+                }
             }
         }