mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 05:25:50 +03:00
Test if we have a correct path.
This commit is contained in:
parent
ce6896453c
commit
9722fd0bad
1 changed files with 12 additions and 5 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "c_lib.h"
|
||||
#include "c_jhash.h"
|
||||
|
@ -54,19 +55,25 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, const csync_vio_fi
|
|||
return -1;
|
||||
}
|
||||
|
||||
path = file;
|
||||
switch (ctx->current) {
|
||||
case LOCAL_REPLICA:
|
||||
path = file + strlen(ctx->local.uri) + 1;
|
||||
if (strlen(path) <= strlen(ctx->local.uri)) {
|
||||
return -1;
|
||||
}
|
||||
path += strlen(ctx->local.uri) + 1;
|
||||
break;
|
||||
case REMOTE_REPLCIA:
|
||||
path = file + strlen(ctx->remote.uri) + 1;
|
||||
if (strlen(path) <= strlen(ctx->remote.uri)) {
|
||||
return -1;
|
||||
}
|
||||
path += strlen(ctx->remote.uri) + 1;
|
||||
break;
|
||||
default:
|
||||
path = NULL;
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
if (path == NULL) {
|
||||
return -1;
|
||||
}
|
||||
len = strlen(path);
|
||||
|
||||
h = c_jhash64((uint8_t *) path, len, 0);
|
||||
|
|
Loading…
Reference in a new issue