# HG changeset patch # User Olaf Wintermann # Date 1679761389 -3600 # Node ID f0d7178043c167ccb4b04fad4d47e983448498d6 # Parent 716f6bf04c301a50fd55694d2f7e7758c90191b8 force mkcol for every directory in the dav put command diff -r 716f6bf04c30 -r f0d7178043c1 dav/main.c --- a/dav/main.c Sun Mar 19 15:12:42 2023 +0100 +++ b/dav/main.c Sat Mar 25 17:23:09 2023 +0100 @@ -1235,6 +1235,17 @@ if(!root) { printf("mkcol: %s\n", file); + DavResource *res = dav_resource_new(sn, path); + res->iscollection = TRUE; + if(!dav_exists(res)) { + if(dav_create(res)) { + fprintf(stderr, "Cannot create collection %s\n", path); + print_resource_error(sn, res->path); + dav_resource_free(res); + return 1; + } + } + dav_resource_free(res); } SYS_DIR dir = sys_opendir(file); @@ -1268,20 +1279,6 @@ } } sys_closedir(dir); - - if(nument == 0) { - // create empty directory - DavResource *res = dav_resource_new(sn, path); - res->iscollection = TRUE; - if(!dav_exists(res)) { - if(dav_create(res)) { - fprintf(stderr, "Cannot create collection %s\n", path); - print_resource_error(sn, res->path); - ret = 1; - } - } - dav_resource_free(res); - } } else if(S_ISREG(s.st_mode)) { if(printfile) { printf("put: %s\n", file);