banshee r4103 - in trunk/banshee: . src/Libraries/Migo/Migo.Syndication
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4103 - in trunk/banshee: . src/Libraries/Migo/Migo.Syndication
- Date: Wed, 4 Jun 2008 00:25:28 +0000 (UTC)
Author: gburt
Date: Wed Jun 4 00:25:28 2008
New Revision: 4103
URL: http://svn.gnome.org/viewvc/banshee?rev=4103&view=rev
Log:
2008-06-03 Gabriel Burt <gabriel burt gmail com>
* src/Libraries/Migo/Migo.Syndication/RssParser.cs: If we fail to load a
XML document b/c it's invalid, remove any non-linebreak control
characters from it and try loading it again.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Libraries/Migo/Migo.Syndication/RssParser.cs
Modified: trunk/banshee/src/Libraries/Migo/Migo.Syndication/RssParser.cs
==============================================================================
--- trunk/banshee/src/Libraries/Migo/Migo.Syndication/RssParser.cs (original)
+++ trunk/banshee/src/Libraries/Migo/Migo.Syndication/RssParser.cs Wed Jun 4 00:25:28 2008
@@ -30,6 +30,7 @@
using System;
using System.Xml;
+using System.Text;
using System.Collections.Generic;
namespace Migo.Syndication
@@ -45,8 +46,30 @@
try {
doc.LoadXml (xml);
} catch (XmlException e) {
- Hyena.Log.Exception (e);
- throw new FormatException ("Invalid XML document.");
+ bool have_stripped_control = false;
+ StringBuilder sb = new StringBuilder ();
+
+ foreach (char c in xml) {
+ if (Char.IsControl (c) && c != '\n') {
+ have_stripped_control = true;
+ } else {
+ sb.Append (c);
+ }
+ }
+
+ bool loaded = false;
+ if (have_stripped_control) {
+ try {
+ doc.LoadXml (sb.ToString ());
+ loaded = true;
+ } catch (Exception) {
+ }
+ }
+
+ if (!loaded) {
+ Hyena.Log.Exception (e);
+ throw new FormatException ("Invalid XML document.");
+ }
}
CheckRss ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]