[mythtv] (no subject)

Dick Smits dick at toughnet.net
Sun Jul 18 17:19:24 EDT 2004


Hello,

When processing RSS feeds with mythnews I sometimes get a URL in the feed
that contains the characters
";" or "&". When you press the ENTER button mythbrowser is called to display
the newsarticle.
The does not work when these characters are present in the URL.
The myth_system call used for this needs the escaped string (a la shell).

Example myth_system argument from nu.nl:
/usr/bin/mythbrowser -z 115 http://nu.nl/news.jsp?n=360482&c=61

This should be:
/usr/bin/mythbrowser -z 115 http://nu\.nl/news\.jsp\?n=360482\&amp\;c=61

This patch adds that to mythnews.cpp.
I'm not a c++ and/or QT coder, so the patch may be not the best solution.

Patch:
Index: mythnews.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythnews/mythnews/mythnews.cpp,v
retrieving revision 1.12
diff -u -w -r1.12 mythnews.cpp
--- mythnews.cpp        25 Jun 2004 21:17:56 -0000      1.12
+++ mythnews.cpp        18 Jul 2004 21:09:30 -0000
@@ -27,6 +27,7 @@
 #include <qpainter.h>
 #include <qdir.h>
 #include <qtimer.h>
+#include <qregexp.h>

 #include "mythnews.h"

@@ -553,7 +554,16 @@
         NewsArticle *article = (NewsArticle*) articleUIItem->getData();
         if(article)
         {
-            QString cmd = QString( "%1 %2
%3").arg(browser).arg(zoom).arg(article->articleURL());
+           QString cmdURL (article->articleURL());
+           cmdURL = QRegExp::escape( cmdURL );
+           int i = cmdURL.find( QRegExp("[;&]"), 0 );
+           while ( i != -1 )
+           {
+               cmdURL = cmdURL.insert( i, "\\");
+               i = cmdURL.find( QRegExp("[;&]"), i+2 );
+           }
+            QString cmd = QString( "%1 %2
%3").arg(browser).arg(zoom).arg(cmdURL);
+
             myth_system( cmd );
         }
      }



-----------------------------------------------------------------
Dick Smits
Zoetermeer, NL



----------------------------------------
My Inbox is protected by SPAMfighter
2691 spam mails have been blocked so far.
Download free www.spamfighter.com today!


More information about the mythtv-dev mailing list