added missing url decode

Thu, 05 Jun 2014 15:39:51 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 05 Jun 2014 15:39:51 +0200
changeset 44
e4e23a88d4de
parent 43
03076907b58a
child 45
e3839719b079

added missing url decode

libidav/methods.c file | annotate | diff | comparison | revisions
--- a/libidav/methods.c	Thu Jun 05 15:11:29 2014 +0200
+++ b/libidav/methods.c	Thu Jun 05 15:39:51 2014 +0200
@@ -228,6 +228,7 @@
     char *url = NULL;
     curl_easy_getinfo(sn->handle, CURLINFO_EFFECTIVE_URL, &url);
     if(!root) {
+        printf("method.c: TODO: remove\n");
         root = dav_resource_new_href(sn, util_url_path(url)); // TODO: remove
     }
     
@@ -355,11 +356,21 @@
                 fprintf(stderr, "decrypted name is null\n");
             }
         } else {
-            name = util_resource_name(href);
+            sstr_t resname = sstr(util_resource_name(href));
+            int nlen = 0;
+            char *uname = curl_easy_unescape(
+                    sn->handle,
+                    resname.ptr,
+                    resname.length,
+                    &nlen);
+            name = dav_session_strdup(sn, uname);
+            curl_free(uname);
         }
         
         href = dav_session_strdup(sn, href);
         res = dav_resource_new_full(sn, resource->path, name, href);
+        
+        dav_session_free(sn, name);
     }
     res->iscollection = iscollection;
     

mercurial