[Pkg-owncloud-commits] [owncloud-client] 147/484: Discovery: Fix detection of hidden files.

Sandro Knauß hefee-guest at moszumanska.debian.org
Wed Dec 16 00:37:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 6b712733803dde23f416bee8699ae1cb02ec7c8a
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Mon Oct 26 14:24:05 2015 +0100

    Discovery: Fix detection of hidden files.
    
    In the discovery phase we want to detect that dot-files are hidden
    on Linux and Mac.
    
    This fixes strange behaviour seen in issue #3980
---
 csync/src/csync_update.c       | 14 ++++++++++++--
 src/libsync/discoveryphase.cpp |  8 +++++++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c
index 99570c2..49546d5 100644
--- a/csync/src/csync_update.c
+++ b/csync/src/csync_update.c
@@ -688,8 +688,8 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
     }
 
     /* skip "." and ".." */
-    if (d_name[0] == '.' && (d_name[1] == '\0'
-          || (d_name[1] == '.' && d_name[2] == '\0'))) {
+    if ( (d_name[0] == '.' && d_name[1] == '\0')
+          || (d_name[0] == '.' && d_name[1] == '.' && d_name[2] == '\0')) {
       csync_vio_file_stat_destroy(dirent);
       dirent = NULL;
       continue;
@@ -748,6 +748,16 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
         res = 0;
     }
 
+    /* for non windows platforms, detect if the filename starts with a .
+     * and if so, it's a hidden file. For windows, the hidden state is
+     * discovered within the vio local stat function.
+     */
+#ifndef _WIN32
+    if( d_name[0] == '.' ) {
+        fs->flags |= CSYNC_VIO_FILE_FLAGS_HIDDEN;
+    }
+#endif
+
     if( res == 0) {
       switch (fs->type) {
         case CSYNC_VIO_FILE_TYPE_SYMBOLIC_LINK:
diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp
index dcf2500..36be74d 100644
--- a/src/libsync/discoveryphase.cpp
+++ b/src/libsync/discoveryphase.cpp
@@ -317,7 +317,13 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file,QMap
         if (!file_stat->etag || strlen(file_stat->etag) == 0) {
             qDebug() << "WARNING: etag of" << file_stat->name << "is" << file_stat->etag << " This must not happen.";
         }
-        if( file.startsWith(QChar('.')) ) {
+
+        QStringRef fileRef(&file);
+        int slashPos = file.lastIndexOf(QLatin1Char('/'));
+        if( slashPos > -1 ) {
+            fileRef = fileRef.mid(slashPos+1);
+        }
+        if( fileRef.startsWith(QChar('.')) ) {
             file_stat->flags = CSYNC_VIO_FILE_FLAGS_HIDDEN;
         }
         //qDebug() << "!!!!" << file_stat << file_stat->name << file_stat->file_id << map.count();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list