diff options
author | Daniel Molkentin <danimo@owncloud.com> | 2014-11-12 02:07:59 +0300 |
---|---|---|
committer | Daniel Molkentin <danimo@owncloud.com> | 2014-11-12 02:07:59 +0300 |
commit | 281c0e155348c5e1da2d08f3147107d0bc32ff9f (patch) | |
tree | 2bf718498bb27a8372b72fc4cf29d683fb3f0d07 /csync | |
parent | b54c079766ef20579f550ef8c0fdd65fc83c6b81 (diff) | |
parent | 52a63a65ef48b60d7ef72632667581ef607b74c3 (diff) |
Merge branch 'master' into rename_client
Conflicts:
CMakeLists.txt
src/gui/main.cpp
src/libsync/accessmanager.cpp
src/libsync/accessmanager.h
src/libsync/owncloudpropagator_p.h
Diffstat (limited to 'csync')
-rw-r--r-- | csync/src/csync.c | 3 | ||||
-rw-r--r-- | csync/src/csync_owncloud.c | 8 | ||||
-rw-r--r-- | csync/src/csync_owncloud_util.c | 1 | ||||
-rw-r--r-- | csync/src/csync_private.h | 2 | ||||
-rw-r--r-- | csync/src/csync_update.c | 8 | ||||
-rw-r--r-- | csync/src/vio/csync_vio_file_stat.h | 2 | ||||
-rw-r--r-- | csync/src/vio/csync_vio_local.c | 6 | ||||
-rwxr-xr-x | csync/tests/ownCloud/t3.pl | 10 |
8 files changed, 39 insertions, 1 deletions
diff --git a/csync/src/csync.c b/csync/src/csync.c index 2cd5fa7d4..976c38be3 100644 --- a/csync/src/csync.c +++ b/csync/src/csync.c @@ -177,6 +177,8 @@ int csync_init(CSYNC *ctx) { goto out; } + ctx->remote.root_perms = 0; + ctx->status = CSYNC_STATUS_INIT; /* initialize random generator */ @@ -559,6 +561,7 @@ static void _csync_clean_ctx(CSYNC *ctx) ctx->local.list = 0; SAFE_FREE(ctx->statedb.file); + SAFE_FREE(ctx->remote.root_perms); } int csync_commit(CSYNC *ctx) { diff --git a/csync/src/csync_owncloud.c b/csync/src/csync_owncloud.c index 837ef8868..5cf08c43f 100644 --- a/csync/src/csync_owncloud.c +++ b/csync/src/csync_owncloud.c @@ -730,6 +730,14 @@ csync_vio_file_stat_t *owncloud_readdir(CSYNC *ctx, csync_vio_handle_t *dhandle) SAFE_FREE( escaped_path ); return lfs; + } else { + /* The first item is the root item, memorize its permissions */ + if (!ctx->remote.root_perms) { + if (strlen(currResource->remotePerm) > 0) { + /* Only copy if permissions contain something. Empty string means server didn't return them */ + ctx->remote.root_perms = c_strdup(currResource->remotePerm); + } + } } /* This is the target URI */ diff --git a/csync/src/csync_owncloud_util.c b/csync/src/csync_owncloud_util.c index 5a5811fa6..8b017d0a8 100644 --- a/csync/src/csync_owncloud_util.c +++ b/csync/src/csync_owncloud_util.c @@ -375,6 +375,7 @@ void fill_webdav_properties_into_resource(struct resource* newres, const ne_prop if (directDownloadCookies) { newres->directDownloadCookies = c_strdup(directDownloadCookies); } + /* DEBUG_WEBDAV("fill_webdav_properties_into_resource %s >%p< ", newres->name, perm ); */ if (perm && !perm[0]) { // special meaning for our code: server returned permissions but are empty // meaning only reading is allowed for this resource diff --git a/csync/src/csync_private.h b/csync/src/csync_private.h index ecc4f772c..764491647 100644 --- a/csync/src/csync_private.h +++ b/csync/src/csync_private.h @@ -117,8 +117,10 @@ struct csync_s { c_list_t *list; enum csync_replica_e type; int read_from_db; + const char *root_perms; /* Permission of the root folder. (Since the root folder is not in the db tree, we need to keep a separate entry.) */ } remote; + #if defined(HAVE_ICONV) && defined(WITH_ICONV) struct { iconv_t iconv_cd; diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c index 80635570e..2934d71ab 100644 --- a/csync/src/csync_update.c +++ b/csync/src/csync_update.c @@ -144,6 +144,14 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, len = strlen(path); + /* This code should probably be in csync_exclude, but it does not have the fs parameter. + Keep it here for now and TODO also find out if we want this for Windows + https://github.com/owncloud/mirall/issues/2086 */ + if (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN) { + CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file excluded because it is a hidden file: %s", path); + return 0; + } + /* Check if file is excluded */ excluded = csync_excluded(ctx, path,type); diff --git a/csync/src/vio/csync_vio_file_stat.h b/csync/src/vio/csync_vio_file_stat.h index 21c4eaf4c..2c0782d46 100644 --- a/csync/src/vio/csync_vio_file_stat.h +++ b/csync/src/vio/csync_vio_file_stat.h @@ -42,7 +42,7 @@ typedef struct csync_vio_file_stat_s csync_vio_file_stat_t; enum csync_vio_file_flags_e { CSYNC_VIO_FILE_FLAGS_NONE = 0, CSYNC_VIO_FILE_FLAGS_SYMLINK = 1 << 0, - CSYNC_VIO_FILE_FLAGS_LOCAL = 1 << 1 + CSYNC_VIO_FILE_FLAGS_HIDDEN = 1 << 1 }; enum csync_vio_file_type_e { diff --git a/csync/src/vio/csync_vio_local.c b/csync/src/vio/csync_vio_local.c index 75383a63e..19b90e64e 100644 --- a/csync/src/vio/csync_vio_local.c +++ b/csync/src/vio/csync_vio_local.c @@ -224,6 +224,7 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) { buf->type = CSYNC_VIO_FILE_TYPE_REGULAR; break; } while (0); + /* TODO Do we want to parse for CSYNC_VIO_FILE_FLAGS_HIDDEN ? */ buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_FLAGS; buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE; @@ -321,6 +322,11 @@ int csync_vio_local_stat(const char *uri, csync_vio_file_stat_t *buf) { } else { buf->flags = CSYNC_VIO_FILE_FLAGS_NONE; } +#ifdef __APPLE__ + if (sb.st_flags & UF_HIDDEN) { + buf->flags |= CSYNC_VIO_FILE_FLAGS_HIDDEN; + } +#endif buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_FLAGS; buf->device = sb.st_dev; diff --git a/csync/tests/ownCloud/t3.pl b/csync/tests/ownCloud/t3.pl index a27409ef2..55742ec67 100755 --- a/csync/tests/ownCloud/t3.pl +++ b/csync/tests/ownCloud/t3.pl @@ -141,6 +141,16 @@ move( localDir() . '3.txt', localDir() . '3_bis.txt' ); system( "echo \"new file un\" > " . localDir() . '1.txt' ); system( "echo \"new file trois\" > " . localDir() . '3.txt' ); +#also add special file with special character for next sync +#and file with special characters +createLocalFile(localDir(). 'hêllo%20th@re.txt' , 1208 ); + +csync(); +assertLocalAndRemoteDir( '', 0); + +printInfo("Move a file containing special character"); + +move(localDir(). 'hêllo%20th@re.txt', localDir(). 'hêllo%20th@re.doc'); csync(); assertLocalAndRemoteDir( '', 0); |