[gvfs] dav: Ignore parameters of the content type header



commit 554f208e7dc065889358d05d8199a2271756b05e
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Mon Aug 25 21:17:24 2014 +0100

    dav: Ignore parameters of the content type header
    
    Ignore parameters of the file's content type since these break
    applications which make use of the content type.
    
    E.g. If the server returns a type such as "text/plain; charset=utf-8",
    the file won't open in a text editor.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676627

 daemon/gvfsbackenddav.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c
index 4dd88ff..36a730d 100644
--- a/daemon/gvfsbackenddav.c
+++ b/daemon/gvfsbackenddav.c
@@ -1018,7 +1018,18 @@ ms_response_to_file_info (MsResponse *response,
             }
           else if (node_has_name (node, "getcontenttype"))
             {
+              char *ptr;
+
               mime_type = g_strdup (text);
+
+              /* Ignore parameters of the content type */
+              ptr = strchr (mime_type, ';');
+              if (ptr)
+                {
+                  do
+                    *ptr-- = '\0';
+                  while (ptr >= mime_type && g_ascii_isspace (*ptr));
+                }
             }
           else if (node_has_name (node, "getcontentlength"))
             {


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