Tue, 12 Dec 2017 23:58:54 +0100
fixes infinite loop when trying to overwrite a collection with a regular file
dav/main.c | file | annotate | diff | comparison | revisions |
--- a/dav/main.c Tue Dec 12 23:36:47 2017 +0100 +++ b/dav/main.c Tue Dec 12 23:58:54 2017 +0100 @@ -922,6 +922,15 @@ } else if(res->iscollection) { // TODO: free res char *newpath = util_concat_path(path, name); + + if (!strcmp(path, newpath)) { + // TODO: free res + fprintf(stderr, "Cannot put file, because a collection with " + "that name already exists.\n"); + free(newpath); + return -1; + } + path = newpath; res = dav_resource_new(sn, path); free(newpath);