mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 05:15:40 +03:00
Remove trailing slashed fo the uris.
This commit is contained in:
parent
745e264f26
commit
bae5bf798a
1 changed files with 11 additions and 2 deletions
13
src/csync.c
13
src/csync.c
|
@ -42,18 +42,27 @@
|
|||
|
||||
int csync_create(CSYNC **csync, const char *local, const char *remote) {
|
||||
CSYNC *ctx;
|
||||
size_t len = 0;
|
||||
|
||||
ctx = c_malloc(sizeof(CSYNC));
|
||||
if (ctx == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ctx->local.uri = c_strdup(local);
|
||||
/* remove trailing slashes */
|
||||
len = strlen(local);
|
||||
while(len > 0 && local[len - 1] == '/') --len;
|
||||
|
||||
ctx->local.uri = c_strndup(local, len);
|
||||
if (ctx->local.uri == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ctx->remote.uri = c_strdup(remote);
|
||||
/* remove trailing slashes */
|
||||
len = strlen(remote);
|
||||
while(len > 0 && remote[len - 1] == '/') --len;
|
||||
|
||||
ctx->remote.uri = c_strndup(remote, len);
|
||||
if (ctx->remote.uri == NULL) {
|
||||
SAFE_FREE(ctx->remote.uri);
|
||||
return -1;
|
||||
|
|
Loading…
Reference in a new issue