remove double slashes in href

This commit is contained in:
wbaumann 2009-07-17 12:01:14 +00:00
parent e0b11e496f
commit eabf5ab4bc
3 changed files with 27 additions and 5 deletions

View File

@ -1,6 +1,10 @@
ChangeLog for davfs2 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) 2009-06-30 Werner Baumann (werner.baumann@onlinehome.de)
* dav_fuse.c, fuse_stat: * dav_fuse.c, fuse_stat:
Correct block counts according to block size. Correct block counts according to block size.

3
TODO
View File

@ -19,3 +19,6 @@ davfs2 TODO 2009-06-13
- object oriented redisign of cache - object oriented redisign of cache


- multithreading for HTTP-requests and cache maintainance - multithreading for HTTP-requests and cache maintainance

- restructure file name extraction and href construction


View File

@ -1685,9 +1685,8 @@ prop_result(void *userdata, const char *href, const ne_prop_result_set *set)
return; return;
} }


dav_props *result = ne_calloc(sizeof(dav_props)); char *tmp_path = (char *) ne_malloc(strlen(uri.path) + 1);
result->path = ne_path_unescape(uri.path); const char *from = uri.path;
ne_uri_free(&uri);


#else /* NE_VERSION_MINOR >= 26 */ #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) if (!ctx || !uri || !uri->path || !set)
return; return;


dav_props *result = ne_calloc(sizeof(dav_props)); char *tmp_path = (char *) ne_malloc(strlen(uri->path) + 1);
result->path = ne_path_unescape(uri->path); const char *from = uri->path;


#endif /* NE_VERSION_MINOR >= 26 */ #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) { if (!result->path || strlen(result->path) < 1) {
dav_delete_props(result); dav_delete_props(result);
return; return;