[gvfs] dav: ignore empty tags in multistatus responses



commit c12296f716102e83647d67017d418129c9cc22c7
Author: Christian Kellner <gicmo gnome org>
Date:   Mon Jun 18 13:31:46 2012 +0200

    dav: ignore empty tags in multistatus responses
    
    The old logic in ms_response_to_file_info () assumed that all
    the tags that were present in the 200 status block of the
    multistatus response actually contain data. Of course some
    server will violate this assumption. We now make sure that tags
    really have content when parsing. Should fix bug 675506.

 daemon/gvfsbackenddav.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c
index 4f1d8e0..8f9eeb5 100644
--- a/daemon/gvfsbackenddav.c
+++ b/daemon/gvfsbackenddav.c
@@ -581,6 +581,18 @@ node_get_content (xmlNodePtr node)
       }
 }
 
+static gboolean
+node_is_empty (xmlNodePtr node)
+{
+  if (node == NULL)
+    return TRUE;
+
+  if (node->type == XML_TEXT_NODE)
+    return node->content == NULL || node->content[0] == '\0';
+
+  return node->children == NULL;
+}
+
 typedef struct _xmlNodeIter {
 
   xmlNodePtr cur_node;
@@ -998,7 +1010,7 @@ ms_response_to_file_info (MsResponse *response,
 
       for (node = propstat.prop_node->children; node; node = node->next)
         {
-          if (! node_is_element (node))
+          if (! node_is_element (node) || node_is_empty (node))
             continue; /* TODO: check namespace, parse user data nodes*/
 
           text = node_get_content (node);



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