diff -r 76bd29a11cc9 -r e554f3d72d9e dav/main.c --- a/dav/main.c Tue Dec 12 23:36:47 2017 +0100 +++ b/dav/main.c Tue Dec 12 23:58:54 2017 +0100 @@ -1162,6 +1162,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);