diff -r 9e85e1ec1155 -r 268157722a0e dav/sync.c --- a/dav/sync.c Thu Mar 28 18:09:31 2019 +0100 +++ b/dav/sync.c Thu Mar 28 18:23:22 2019 +0100 @@ -1073,6 +1073,7 @@ } UcxList *part_updates = NULL; uint64_t blockcount = 0; + char *content_hash = NULL; if(res->iscollection && !issplit) { // why are we here? @@ -1114,8 +1115,18 @@ ret = dav_get_content(res, out, (dav_write_func)fwrite); } fclose(out); - if(truncate_file >= 0) { - truncate(tmp_path, truncate_file); + + if(issplit) { + if(truncate_file >= 0) { + truncate(tmp_path, truncate_file); + } + + char *res_hash = sync_get_content_hash(res); + if(res_hash) { + content_hash = res_hash; + } else { + content_hash = util_file_hash(local_path); + } } if(ret == 0) { @@ -1157,11 +1168,17 @@ if(local->etag) { free(local->etag); } + if(local->hash) { + free(local->hash); + } update_parts(local, part_updates, blockcount); // set metadata from stat local->etag = strdup(etag); + if(content_hash) { + local->hash = content_hash; + } sync_set_metadata_from_stat(local, &s); local->skipped = FALSE; } else if(tmp_path) {