mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
ownCloud: append a trailing slash in mkdir as neon requests.
This commit is contained in:
parent
a454156dc2
commit
9b8e75e4fc
1 changed files with 17 additions and 3 deletions
|
@ -1026,9 +1026,16 @@ static csync_vio_file_stat_t *owncloud_readdir(csync_vio_method_handle_t *dhandl
|
||||||
|
|
||||||
static int owncloud_mkdir(const char *uri, mode_t mode) {
|
static int owncloud_mkdir(const char *uri, mode_t mode) {
|
||||||
int rc = NE_OK;
|
int rc = NE_OK;
|
||||||
|
char buf[PATH_MAX +1];
|
||||||
|
int len = 0;
|
||||||
|
|
||||||
char *path = _cleanPath( uri );
|
char *path = _cleanPath( uri );
|
||||||
(void) mode; /* unused */
|
(void) mode; /* unused */
|
||||||
|
|
||||||
|
if( ! path ) {
|
||||||
|
errno = EINVAL;
|
||||||
|
rc = -1;
|
||||||
|
}
|
||||||
rc = dav_connect(uri);
|
rc = dav_connect(uri);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
@ -1036,10 +1043,17 @@ static int owncloud_mkdir(const char *uri, mode_t mode) {
|
||||||
|
|
||||||
/* the uri path is required to have a trailing slash */
|
/* the uri path is required to have a trailing slash */
|
||||||
if( rc >= 0 ) {
|
if( rc >= 0 ) {
|
||||||
DEBUG_WEBDAV(("MKdir on %s\n", path ));
|
memset( buf,0, PATH_MAX+1 );
|
||||||
rc = ne_mkcol(dav_session.ctx, path );
|
len = strlen( path );
|
||||||
|
strncpy( buf, path, len );
|
||||||
|
if( buf[len-1] != '/' ) {
|
||||||
|
buf[len] = '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG_WEBDAV(("MKdir on %s\n", buf ));
|
||||||
|
rc = ne_mkcol(dav_session.ctx, buf );
|
||||||
if (rc != NE_OK ) {
|
if (rc != NE_OK ) {
|
||||||
errno = ne_error_to_errno(rc);
|
errno = ne_session_error_errno( dav_session.ctx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SAFE_FREE( path );
|
SAFE_FREE( path );
|
||||||
|
|
Loading…
Reference in a new issue