Bug 100118 - serendipity feed images not displayed
Summary: serendipity feed images not displayed
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-23 21:43 UTC by kris
Modified: 2005-02-26 23:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kris 2005-02-23 21:43:01 UTC
Version:           1.0 beta10 (using KDE 3.4.0 Level "a" , SUSE 9.2 UNSUPPORTED)
Compiler:          gcc version 3.3.4 (pre 3.3.5 20040809)
OS:                Linux (i686) release 2.6.8-24.11-default

I am using serendipity (http://www.s9y.org) as a blog system. My feed http://blog.koehntopp.de/rss.php?version=2.0 contains an image, but akregator only shows a generic image symbol on the right hand side of each article. This is true for all other s9y generated feeds.

Images for other feeds, e.g. http://www.livejournal.com/users/jwz/data/rss are shown properly.

What is wrong - is the image tag malformed or does akgregator have a problem with this image element?

Does not work:

<channel>
    <title>Die wunderbare Welt von Isotopp</title>
    <link>http://blog.koehntopp.de/</link>
    <description></description>
    <dc:language>de</dc:language>
    <admin:errorReportsTo rdf:resource="mailto:kris@koehntopp.de" />
    <generator>Serendipity 0.8-alpha11 - http://www.s9y.org/</generator>
    <managingEditor>kris@koehntopp.de</managingEditor>
<webMaster>kris@koehntopp.de</webMaster>
<ttl>60</ttl>
<image>
        <url>http://blog.koehntopp.de/webcam/kris.png</url>
        <title>RSS: Die wunderbare Welt von Isotopp - </title>
        <link>http://blog.koehntopp.de/</link>
        <width>129</width>
        <height>185</height>
    </image>
...

Does work:

<channel>
  <title>jwz</title>
  <link>http://www.livejournal.com/users/jwz/</link>
  <description>jwz - LiveJournal.com</description>
  <managingEditor>jwz@jwz.org</managingEditor>
  <lastBuildDate>Wed, 23 Feb 2005 10:29:51 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <image>
    <url>http://www.livejournal.com/userpic/5887295/515656</url>
    <title>jwz</title>
    <link>http://www.livejournal.com/users/jwz/</link>
    <width>83</width>
    <height>83</height>
  </image>

...
Comment 1 Teemu Rytilahti 2005-02-24 21:17:48 UTC
This is caused by the way the image urls are currently handled and not escaped before use. I just fixed this to my local copy, but can't commit yet since the cvs is frozen...
Comment 2 Teemu Rytilahti 2005-02-26 23:17:03 UTC
CVS commit by rytilahti: 

Umm, use KURL for url handling instead of QString... Will backport soon.
BUGS:100118


  M +11 -4     articleviewer.cpp   1.94
  M +1 -1      articleviewer.h   1.35


--- kdepim/akregator/src/articleviewer.cpp  #1.93:1.94
@@ -59,5 +59,6 @@ ArticleViewer::ArticleViewer(QWidget *pa
     connect(kapp, SIGNAL(kdisplayPaletteChanged()), this, SLOT(slotPaletteOrFontChanged()) );
     connect(kapp, SIGNAL(kdisplayFontChanged()), this, SLOT(slotPaletteOrFontChanged()) );
-    m_imageDir="file:"+KGlobal::dirs()->saveLocation("cache", "akregator/Media/");
+    
+    m_imageDir.setPath(KGlobal::dirs()->saveLocation("cache", "akregator/Media/"));
     m_htmlFooter = "</body></html>";
 }
@@ -218,5 +219,8 @@ QString ArticleViewer::formatArticle(Fee
     {
         QString url=feed->xmlUrl();
-        text += QString("<a href=\""+feed->htmlUrl()+"\"><img class=\"headimage\" src=\""+m_imageDir+url.replace("/", "_").replace(":", "_")+".png\"></a>\n");
+        QString file = url.replace("/", "_").replace(":", "_");
+        KURL u(m_imageDir);
+        u.setFileName(file);
+        text += QString("<a href=\"%1\"><img class=\"headimage\" src=\"%2.png\"></a>\n").arg(feed->htmlUrl()).arg(u.url());
     }
 
@@ -349,5 +353,8 @@ void ArticleViewer::showSummary(Feed *f)
         text += QString("<div class=\"body\">");
         QString url=f->xmlUrl();
-        text += QString("<a href=\""+f->htmlUrl()+"\"><img class=\"headimage\" src=\""+m_imageDir+url.replace("/", "_").replace(":", "_")+".png\"></a>\n");
+        QString file = url.replace("/", "_").replace(":", "_");
+        KURL u(m_imageDir);
+        u.setFileName(file);
+        text += QString("<a href=\"%1\"><img class=\"headimage\" src=\"%2.png\"></a>\n").arg(f->htmlUrl()).arg(u.url());
     }
     else text += "<div class=\"body\">";

--- kdepim/akregator/src/articleviewer.h  #1.34:1.35
@@ -103,5 +103,5 @@ namespace Akregator
             QString m_htmlFooter;
             QString m_currentText;
-            QString m_imageDir;
+            KURL m_imageDir;
             TreeNode* m_node;
             ArticleFilter m_textFilter; 


Comment 3 Teemu Rytilahti 2005-02-26 23:26:22 UTC
CVS commit by rytilahti: 

backport
CCBUGS:100118


  M +11 -4     articleviewer.cpp   1.93.4.1
  M +1 -1      articleviewer.h   1.34.6.1


--- kdepim/akregator/src/articleviewer.cpp  #1.93:1.93.4.1
@@ -59,5 +59,6 @@ ArticleViewer::ArticleViewer(QWidget *pa
     connect(kapp, SIGNAL(kdisplayPaletteChanged()), this, SLOT(slotPaletteOrFontChanged()) );
     connect(kapp, SIGNAL(kdisplayFontChanged()), this, SLOT(slotPaletteOrFontChanged()) );
-    m_imageDir="file:"+KGlobal::dirs()->saveLocation("cache", "akregator/Media/");
+    
+    m_imageDir.setPath(KGlobal::dirs()->saveLocation("cache", "akregator/Media/"));
     m_htmlFooter = "</body></html>";
 }
@@ -218,5 +219,8 @@ QString ArticleViewer::formatArticle(Fee
     {
         QString url=feed->xmlUrl();
-        text += QString("<a href=\""+feed->htmlUrl()+"\"><img class=\"headimage\" src=\""+m_imageDir+url.replace("/", "_").replace(":", "_")+".png\"></a>\n");
+        QString file = url.replace("/", "_").replace(":", "_");
+        KURL u(m_imageDir);
+        u.setFileName(file);
+        text += QString("<a href=\"%1\"><img class=\"headimage\" src=\"%2.png\"></a>\n").arg(feed->htmlUrl()).arg(u.url());
     }
 
@@ -349,5 +353,8 @@ void ArticleViewer::showSummary(Feed *f)
         text += QString("<div class=\"body\">");
         QString url=f->xmlUrl();
-        text += QString("<a href=\""+f->htmlUrl()+"\"><img class=\"headimage\" src=\""+m_imageDir+url.replace("/", "_").replace(":", "_")+".png\"></a>\n");
+        QString file = url.replace("/", "_").replace(":", "_");
+        KURL u(m_imageDir);
+        u.setFileName(file);
+        text += QString("<a href=\"%1\"><img class=\"headimage\" src=\"%2.png\"></a>\n").arg(f->htmlUrl()).arg(u.url());
     }
     else text += "<div class=\"body\">";

--- kdepim/akregator/src/articleviewer.h  #1.34:1.34.6.1
@@ -103,5 +103,5 @@ namespace Akregator
             QString m_htmlFooter;
             QString m_currentText;
-            QString m_imageDir;
+            KURL m_imageDir;
             TreeNode* m_node;
             ArticleFilter m_textFilter;