site_url problems with magpie

Development-related discussion, including bundled plugins
User avatar
gmargo
Bear Rating Disaster
Bear Rating Disaster
Posts: 62
Joined: 08 Jan 2012, 22:33
Location: Silicon Valley

site_url problems with magpie

Postby gmargo » 16 Jan 2012, 22:43

I was inspecting the ttrss_feeds table in the database, and I noticed that two of my feeds (from the same source) had their 'site_url' field prepended with a number of spaces. I determined that the update.php process had modified the 'site_url' from a valid (with no spaces) to an invalid value (with leading spaces).

The sites in question are:
SANS ISC http://isc.sans.edu/rssfeed_full.xml
SANS ISC News http://isc.sans.edu/newssummary.xml

These RSS feeds have bonus leading spaces in the 'title' and 'link' fields. Example from newsummary.xml:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="/css/rss.css" type="text/css"?>
<rss version="2.0">
<channel>
  <title>      SANS ISC SecNewsFeed</title>
  <link>       http://isc.sans.org</link>
  <description><![CDATA[]]></description>
  <language>   en-us</language>


When "Magpie" interprets this, it does not remove the leading whitespace from the <title> and <link> elements. Should it? I don't know; probably not.

The following minor patch to include/rssfuncs.php adds a "trim()" call so that this does not create a problem.

Code: Select all

diff --git a/include/rssfuncs.php b/include/rssfuncs.php
index 96e8cbd..04fa773 100644
--- a/include/rssfuncs.php
+++ b/include/rssfuncs.php
@@ -422,7 +422,7 @@
                                $site_url = $rss->channel["link"];
                        }
 
-                       $site_url = rewrite_relative_url($fetch_url, $site_url);
+                       $site_url = rewrite_relative_url($fetch_url, trim($site_url));
 
                        if ($debug_enabled) {
                                _debug("update_rss_feed: checking favicon...");

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: site_url problems with magpie

Postby fox » 17 Jan 2012, 10:23

Thanks, should be fixed in trunk now.

https://github.com/gothfox/Tiny-Tiny-RS ... b0b534d53d


Return to “Development”

Who is online

Users browsing this forum: No registered users and 3 guests