site_url problems with magpie

Development-related discussion, including bundled plugins
User avatar
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:

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">
  <title>      SANS ISC SecNewsFeed</title>
  <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
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia

Re: site_url problems with magpie

Postby fox » 17 Jan 2012, 10:23

Thanks, should be fixed in trunk now. ... b0b534d53d

Return to “Development”

Who is online

Users browsing this forum: No registered users and 13 guests