Sat, 05 Aug 2017 11:08:34 +0200
fixes dav_resource_new_full
libidav/resource.c | file | annotate | diff | comparison | revisions |
--- a/libidav/resource.c Sat Aug 05 10:57:47 2017 +0200 +++ b/libidav/resource.c Sat Aug 05 11:08:34 2017 +0200 @@ -81,11 +81,13 @@ DavResource* dav_resource_new_full(DavSession *sn, char *parent_path, char *name, char *href) { sstr_t n = sstr(name); // the name must not contain path separators - for(int i=0;i<n.length-1;i++) { - char c = n.ptr[i]; - if(c == '/' || c == '\\') { - n = sstr(util_resource_name(href)); - break; + if(n.length > 0) { + for(int i=0;i<n.length-1;i++) { + char c = n.ptr[i]; + if(c == '/' || c == '\\') { + n = sstr(util_resource_name(href)); + break; + } } } // remove trailing '/'