totem-pl-parser r82 - in trunk: . plparse



Author: hadess
Date: Mon Mar 17 14:33:53 2008
New Revision: 82
URL: http://svn.gnome.org/viewvc/totem-pl-parser?rev=82&view=rev

Log:
2008-03-17  Bastien Nocera  <hadess hadess net>

	* plparse/totem-pl-parser-podcast.c (totem_pl_parser_is_rss),
	(totem_pl_parser_add_rss): Handle feeds with "<rss\n" as the
	document name (work-around XML parser bug), as seen in
	http://spanishpod.com/lessons/feed/ (Closes: #522968)

	* plparse/totem-pl-parser.c (totem_pl_parser_parse_internal):
	More debug when ignoring unsafe playlist types



Modified:
   trunk/ChangeLog
   trunk/plparse/totem-pl-parser-podcast.c
   trunk/plparse/totem-pl-parser.c

Modified: trunk/plparse/totem-pl-parser-podcast.c
==============================================================================
--- trunk/plparse/totem-pl-parser-podcast.c	(original)
+++ trunk/plparse/totem-pl-parser-podcast.c	Mon Mar 17 14:33:53 2008
@@ -42,6 +42,7 @@
 #include "totem-pl-parser-private.h"
 
 #define RSS_NEEDLE "<rss "
+#define RSS_NEEDLE2 "<rss\n"
 #define ATOM_NEEDLE "<feed "
 #define OPML_NEEDLE "<opml "
 
@@ -56,6 +57,9 @@
 	if (memmem (data, len,
 		    RSS_NEEDLE, strlen (RSS_NEEDLE)) != NULL)
 		return RSS_MIME_TYPE;
+	if (memmem (data, len,
+		    RSS_NEEDLE2, strlen (RSS_NEEDLE2)) != NULL)
+		return RSS_MIME_TYPE;
 
 	return NULL;
 }
@@ -249,12 +253,14 @@
 
 	xml_parser_init (contents, size, XML_PARSER_CASE_INSENSITIVE);
 	if (xml_parser_build_tree_with_options (&doc, XML_PARSER_RELAXED | XML_PARSER_MULTI_TEXT) < 0) {
+		g_message ("can't parse the file");
 		g_free (contents);
 		return TOTEM_PL_PARSER_RESULT_ERROR;
 	}
 	/* If the document has no name */
 	if (doc->name == NULL
-	    || g_ascii_strcasecmp (doc->name , "rss") != 0) {
+	    || (g_ascii_strcasecmp (doc->name , "rss") != 0
+	    	&& g_ascii_strcasecmp (doc->name , "rss\n") != 0)) {
 		g_free (contents);
 		xml_parser_free_tree (doc);
 		return TOTEM_PL_PARSER_RESULT_ERROR;

Modified: trunk/plparse/totem-pl-parser.c
==============================================================================
--- trunk/plparse/totem-pl-parser.c	(original)
+++ trunk/plparse/totem-pl-parser.c	Mon Mar 17 14:33:53 2008
@@ -1599,6 +1599,7 @@
 			if (strcmp (special_types[i].mimetype, mimetype) == 0) {
 				DEBUG(file, g_print ("URL '%s' is special type '%s'\n", uri, mimetype));
 				if (parser->priv->disable_unsafe != FALSE && special_types[i].unsafe != FALSE) {
+					DEBUG(g_print ("URL '%s' is unsafe so was ignored\n", url));
 					g_free (mimetype);
 					g_free (data);
 					return TOTEM_PL_PARSER_RESULT_IGNORED;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]