1160 return -1; |
1160 return -1; |
1161 } |
1161 } |
1162 } else if(res->iscollection) { |
1162 } else if(res->iscollection) { |
1163 // TODO: free res |
1163 // TODO: free res |
1164 char *newpath = util_concat_path(path, name); |
1164 char *newpath = util_concat_path(path, name); |
|
1165 |
|
1166 if (!strcmp(path, newpath)) { |
|
1167 // TODO: free res |
|
1168 fprintf(stderr, "Cannot put file, because a collection with " |
|
1169 "that name already exists.\n"); |
|
1170 free(newpath); |
|
1171 return -1; |
|
1172 } |
|
1173 |
1165 path = newpath; |
1174 path = newpath; |
1166 res = dav_resource_new(sn, path); |
1175 res = dav_resource_new(sn, path); |
1167 free(newpath); |
1176 free(newpath); |
1168 int ret = put_file(repo, a, sn, res->path, NULL, in, len); |
1177 int ret = put_file(repo, a, sn, res->path, NULL, in, len); |
1169 // TODO: free res |
1178 // TODO: free res |