mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-25 22:05:53 +03:00
ownCloud: Fix bug #613: Encode strange url correctly.
see http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-613
This commit is contained in:
parent
b261ecb705
commit
43263d8e9d
1 changed files with 12 additions and 4 deletions
|
@ -425,26 +425,34 @@ static void results(void *userdata,
|
||||||
const ne_status *status = NULL;
|
const ne_status *status = NULL;
|
||||||
char *path = ne_path_unescape( uri->path );
|
char *path = ne_path_unescape( uri->path );
|
||||||
|
|
||||||
|
/* It seems strange: first uri->path is unescaped to escape it in the next step again.
|
||||||
|
* The reason is that uri->path is not completely escaped (ie. it seems only to have
|
||||||
|
* spaces escaped), while the fetchCtx->target is fully escaped.
|
||||||
|
* See http://bugs.owncloud.org/thebuggenie/owncloud/issues/oc-613
|
||||||
|
*/
|
||||||
|
char *escaped_path = ne_path_escape( path );
|
||||||
|
|
||||||
(void) status;
|
(void) status;
|
||||||
if( ! fetchCtx ) {
|
if( ! fetchCtx ) {
|
||||||
DEBUG_WEBDAV(("No valid fetchContext\n"));
|
DEBUG_WEBDAV(("No valid fetchContext\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DEBUG_WEBDAV(("** propfind result found: %s\n", path )); */
|
|
||||||
if( ! fetchCtx->target ) {
|
if( ! fetchCtx->target ) {
|
||||||
DEBUG_WEBDAV(("error: target must not be zero!\n" ));
|
DEBUG_WEBDAV(("error: target must not be zero!\n" ));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ne_path_compare(fetchCtx->target, uri->path) == 0 && !fetchCtx->include_target) {
|
/* see if the target should be included in the result list. */
|
||||||
|
if (ne_path_compare(fetchCtx->target, escaped_path) == 0 && !fetchCtx->include_target) {
|
||||||
/* This is the target URI */
|
/* This is the target URI */
|
||||||
DEBUG_WEBDAV(( "Skipping target resource.\n"));
|
DEBUG_WEBDAV(( "Skipping target resource.\n"));
|
||||||
/* Free the private structure. */
|
/* Free the private structure. */
|
||||||
SAFE_FREE( path );
|
SAFE_FREE( path );
|
||||||
|
SAFE_FREE( escaped_path );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SAFE_FREE( escaped_path );
|
||||||
/* Fill the resource structure with the data about the file */
|
/* Fill the resource structure with the data about the file */
|
||||||
newres = c_malloc(sizeof(struct resource));
|
newres = c_malloc(sizeof(struct resource));
|
||||||
newres->uri = path; /* no need to strdup because ne_path_unescape already allocates */
|
newres->uri = path; /* no need to strdup because ne_path_unescape already allocates */
|
||||||
|
@ -1243,7 +1251,7 @@ static csync_vio_file_stat_t *owncloud_readdir(csync_vio_method_handle_t *dhandl
|
||||||
_fs.size = lfs->size;
|
_fs.size = lfs->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEBUG_WEBDAV(("LFS fields: %s: %d\n", lfs->name, lfs->type ));
|
/* DEBUG_WEBDAV(("LFS fields: %s: %d\n", lfs->name, lfs->type )); */
|
||||||
return lfs;
|
return lfs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue