From: Olivier Goffart Date: Fri, 28 Apr 2017 11:16:19 +0000 (+0200) Subject: Discovery: Increase the MAX_DEPTH and show deep folder as ignored X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~752 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=13705999f731042965bae3caa43b7245e7b369e0;p=nextcloud-desktop.git Discovery: Increase the MAX_DEPTH and show deep folder as ignored Before this patch, to deep folder would just be ignored, without any feedback. This patch makes it so deep folder are properly shown as ignored in the UI. Also increase the MAX_DEPTH Issue: #1067 --- diff --git a/csync/src/csync.h b/csync/src/csync.h index 770301697..65b40c97e 100644 --- a/csync/src/csync.h +++ b/csync/src/csync.h @@ -99,7 +99,8 @@ enum csync_status_codes_e { CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN, CSYNC_STATUS_INVALID_CHARACTERS, CSYNC_STATUS_INDIVIDUAL_STAT_FAILED, - CSYNC_STATUS_FORBIDDEN + CSYNC_STATUS_FORBIDDEN, + CSYNC_STATUS_INDIVIDUAL_TOO_DEEP }; typedef enum csync_status_codes_e CSYNC_STATUS; diff --git a/csync/src/csync_private.h b/csync/src/csync_private.h index 48875d20e..a10b09f6f 100644 --- a/csync/src/csync_private.h +++ b/csync/src/csync_private.h @@ -58,7 +58,7 @@ /** * How deep to scan directories. */ -#define MAX_DEPTH 50 +#define MAX_DEPTH 100 #define CSYNC_STATUS_INIT 1 << 0 #define CSYNC_STATUS_UPDATE 1 << 1 diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c index 66c8e965c..2253783ce 100644 --- a/csync/src/csync_update.c +++ b/csync/src/csync_update.c @@ -643,6 +643,11 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn, int rc = 0; int res = 0; + if (!depth) { + mark_current_item_ignored(ctx, previous_fs, CSYNC_STATUS_INDIVIDUAL_TOO_DEEP); + goto done; + } + bool do_read_from_db = (ctx->current == REMOTE_REPLICA && ctx->remote.read_from_db); read_from_db = ctx->remote.read_from_db; @@ -798,7 +803,7 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn, goto error; } - if (flag == CSYNC_FTW_FLAG_DIR && depth && rc == 0 + if (flag == CSYNC_FTW_FLAG_DIR && rc == 0 && (!ctx->current_fs || ctx->current_fs->instruction != CSYNC_INSTRUCTION_IGNORE)) { rc = csync_ftw(ctx, filename, fn, depth - 1); if (rc < 0) { diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index e3197b98e..940ae4f8f 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -478,6 +478,9 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote ) case CSYNC_STATUS_INDIVIDUAL_EXCLUDE_HIDDEN: item->_errorString = tr("File/Folder is ignored because it's hidden."); break; + case CSYNC_STATUS_INDIVIDUAL_TOO_DEEP: + item->_errorString = tr("Folder hierarchy is too deep"); + break; case CYSNC_STATUS_FILE_LOCKED_OR_OPEN: item->_errorString = QLatin1String("File locked"); // don't translate, internal use! break;