# HG changeset patch # User Olaf Wintermann # Date 1506872279 -7200 # Node ID 7e06944238383f946144a7772e0d2b7388322e14 # Parent 7eea57f6d8476439828503ea8c1ed293276a4944 dav-sync bugfix: files that are not in the db but on the server should not be pushed diff -r 7eea57f6d847 -r 7e0694423838 dav/main.c --- a/dav/main.c Sun Sep 24 14:31:42 2017 +0200 +++ b/dav/main.c Sun Oct 01 17:37:59 2017 +0200 @@ -820,7 +820,7 @@ if(!recursive) { fprintf( stderr, - "%s is a directory.\nUse the -R option to upload directories.", + "%s is a directory.\nUse the -R option to upload directories.\n", file); return 1; } diff -r 7eea57f6d847 -r 7e0694423838 dav/sync.c --- a/dav/sync.c Sun Sep 24 14:31:42 2017 +0200 +++ b/dav/sync.c Sun Oct 01 17:37:59 2017 +0200 @@ -1181,7 +1181,10 @@ int ret = 0; if(remote) { char *etag = dav_get_property(remote, "D:getetag"); - if(etag && res->etag) { + if(!res->etag) { + // the resource is on the server and the client has no etag + ret = 1; + } else if(etag) { sstr_t e = sstr(etag); if(sstrprefix(e, S("W/"))) { e = sstrsubs(e, 2); @@ -1189,6 +1192,9 @@ if(strcmp(e.ptr, res->etag)) { ret = 1; } + } else { + // something weird is happening, the server must support etags + fprintf(stderr, "Warning: resource %s has no etag\n", remote->href); } dav_resource_free(remote); }