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--; |