[Pkg-owncloud-commits] [owncloud-client] 244/470: Fix sibbling directories showing up as warning

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:25:09 UTC 2016


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 56064c9366e06d128badc273f5a1c270035aa7e3
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Wed Mar 30 11:22:01 2016 +0200

    Fix sibbling directories showing up as warning
    
    Looking up a/aa while an error is present in a/aab/aaba would return
    a warning status since a/aa is a substring of a/aab.
    Fix the issue by checking if the following character is a slash.
---
 src/libsync/syncfilestatustracker.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/libsync/syncfilestatustracker.cpp b/src/libsync/syncfilestatustracker.cpp
index 5b57975..61ebcfb 100644
--- a/src/libsync/syncfilestatustracker.cpp
+++ b/src/libsync/syncfilestatustracker.cpp
@@ -26,11 +26,12 @@ static SyncFileStatus::SyncFileStatusTag lookupProblem(const QString &pathToMatc
         const QString &problemPath = it->first;
         SyncFileStatus::SyncFileStatusTag severity = it->second;
         // qDebug() << Q_FUNC_INFO << pathToMatch << severity << problemPath;
-        if (problemPath == pathToMatch)
+        if (problemPath == pathToMatch) {
             return severity;
-        else if (severity == SyncFileStatus::StatusError && problemPath.startsWith(pathToMatch))
+        } else if (severity == SyncFileStatus::StatusError && problemPath.startsWith(pathToMatch) && problemPath.at(pathToMatch.size()) == '/') {
+            Q_ASSERT(!pathToMatch.endsWith('/'));
             return SyncFileStatus::StatusWarning;
-        else if (!problemPath.startsWith(pathToMatch))
+        } else if (!problemPath.startsWith(pathToMatch)) {
             // Starting at lower_bound we get the first path that is not smaller,
             // since: "/a/" < "/a/aa" < "/a/aa/aaa" < "/a/ab/aba"
             // If problemMap keys are ["/a/aa/aaa", "/a/ab/aba"] and pathToMatch == "/a/aa",
@@ -38,6 +39,7 @@ static SyncFileStatus::SyncFileStatusTag lookupProblem(const QString &pathToMatc
             // problemPath.startsWith(pathToMatch) == false, we know that we've looked
             // at everything that interest us.
             break;
+        }
     }
     return SyncFileStatus::StatusNone;
 }

-- 
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