diff --git a/ChangeLog b/ChangeLog index 5e9acb2..9c34d6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ ChangeLog for davfs2 -------------------- +2009-07-17 Werner Baumann (werner.baumann@onlinehome.de) + * webdav.c, prop_result: + Remove double slashes from path. + 2009-06-30 Werner Baumann (werner.baumann@onlinehome.de) * dav_fuse.c, fuse_stat: Correct block counts according to block size. diff --git a/TODO b/TODO index 1d74355..7b9190c 100644 --- a/TODO +++ b/TODO @@ -19,3 +19,6 @@ davfs2 TODO 2009-06-13 - object oriented redisign of cache - multithreading for HTTP-requests and cache maintainance + +- restructure file name extraction and href construction + diff --git a/src/webdav.c b/src/webdav.c index 4bdaece..09fa11d 100644 --- a/src/webdav.c +++ b/src/webdav.c @@ -1685,9 +1685,8 @@ prop_result(void *userdata, const char *href, const ne_prop_result_set *set) return; } - dav_props *result = ne_calloc(sizeof(dav_props)); - result->path = ne_path_unescape(uri.path); - ne_uri_free(&uri); + char *tmp_path = (char *) ne_malloc(strlen(uri.path) + 1); + const char *from = uri.path; #else /* NE_VERSION_MINOR >= 26 */ @@ -1698,11 +1697,27 @@ prop_result(void *userdata, const ne_uri *uri, const ne_prop_result_set *set) if (!ctx || !uri || !uri->path || !set) return; - dav_props *result = ne_calloc(sizeof(dav_props)); - result->path = ne_path_unescape(uri->path); + char *tmp_path = (char *) ne_malloc(strlen(uri->path) + 1); + const char *from = uri->path; #endif /* NE_VERSION_MINOR >= 26 */ + char *to = tmp_path; + while (*from) { + while (*from == '/' && *(from + 1) == '/') + from++; + *to++ = *from++; + } + *to = 0; + dav_props *result = ne_calloc(sizeof(dav_props)); + result->path = ne_path_unescape(tmp_path); + free (tmp_path); + +#if NE_VERSION_MINOR < 26 + ne_uri_free(&uri); +#endif + + if (!result->path || strlen(result->path) < 1) { dav_delete_props(result); return;