libidav/resource.c

changeset 280
6d8784bee427
parent 269
c89633916e36
child 298
755b8198b071
equal deleted inserted replaced
279:f0f24da5f920 280:6d8784bee427
79 } 79 }
80 80
81 DavResource* dav_resource_new_full(DavSession *sn, char *parent_path, char *name, char *href) { 81 DavResource* dav_resource_new_full(DavSession *sn, char *parent_path, char *name, char *href) {
82 sstr_t n = sstr(name); 82 sstr_t n = sstr(name);
83 // the name must not contain path separators 83 // the name must not contain path separators
84 for(int i=0;i<n.length-1;i++) { 84 if(n.length > 0) {
85 char c = n.ptr[i]; 85 for(int i=0;i<n.length-1;i++) {
86 if(c == '/' || c == '\\') { 86 char c = n.ptr[i];
87 n = sstr(util_resource_name(href)); 87 if(c == '/' || c == '\\') {
88 break; 88 n = sstr(util_resource_name(href));
89 break;
90 }
89 } 91 }
90 } 92 }
91 // remove trailing '/' 93 // remove trailing '/'
92 if(n.length > 0 && n.ptr[n.length-1] == '/') { 94 if(n.length > 0 && n.ptr[n.length-1] == '/') {
93 n.length--; 95 n.length--;

mercurial