920 return -1; |
920 return -1; |
921 } |
921 } |
922 } else if(res->iscollection) { |
922 } else if(res->iscollection) { |
923 // TODO: free res |
923 // TODO: free res |
924 char *newpath = util_concat_path(path, name); |
924 char *newpath = util_concat_path(path, name); |
|
925 |
|
926 if (!strcmp(path, newpath)) { |
|
927 // TODO: free res |
|
928 fprintf(stderr, "Cannot put file, because a collection with " |
|
929 "that name already exists.\n"); |
|
930 free(newpath); |
|
931 return -1; |
|
932 } |
|
933 |
925 path = newpath; |
934 path = newpath; |
926 res = dav_resource_new(sn, path); |
935 res = dav_resource_new(sn, path); |
927 free(newpath); |
936 free(newpath); |
928 int ret = put_file(repo, a, sn, res->path, NULL, in, len); |
937 int ret = put_file(repo, a, sn, res->path, NULL, in, len); |
929 // TODO: free res |
938 // TODO: free res |