mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
util: Improve statedb hashing function to avoid possible data loss.
The statedb hash function only hashes the remote side and not the local path. So if a user changes to a new empty directory to sync it with the remote counter part, csync will delete all files. This will result in a new full sync for all sync setups, but we will not loose any data.
This commit is contained in:
parent
12d5d012f3
commit
68abef8626
1 changed files with 1 additions and 6 deletions
|
@ -296,7 +296,6 @@ out:
|
|||
|
||||
/* Normalize the uri to <host>/<path> */
|
||||
uint64_t csync_create_statedb_hash(CSYNC *ctx) {
|
||||
char *p = NULL;
|
||||
char *host = NULL;
|
||||
char *path = NULL;
|
||||
char name[PATH_MAX] = {0};
|
||||
|
@ -308,12 +307,8 @@ uint64_t csync_create_statedb_hash(CSYNC *ctx) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (host && (p = strchr(host, '.'))) {
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
/* len + 1 for \0 */
|
||||
snprintf(name, PATH_MAX, "%s%s", host ? host : "", path);
|
||||
snprintf(name, sizeof(name), "%s:%s%s", ctx->local.uri, host ? host : "", path);
|
||||
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_INFO,
|
||||
"Normalized path for the statedb hash: %s", name);
|
||||
|
|
Loading…
Reference in a new issue