Fix trailing slash procedure in DiscoveryPhase::checkSelectiveSyncNewFolder
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 10 Jul 2023 09:22:14 +0000 (17:22 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 4 Aug 2023 09:40:42 +0000 (17:40 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/libsync/discoveryphase.cpp

index 81aa34ea8f11d7acb71220aaa273ea3111243ab6..e992159a9331bd80dd0868982674d38befe3ccf3 100644 (file)
@@ -122,7 +122,8 @@ void DiscoveryPhase::checkSelectiveSyncNewFolder(const QString &path,
         }
 
         // it is not too big, put it in the white list (so we will not do more query for the children) and and do not block.
-        const auto sanitisedPath = path.endsWith(QLatin1Char('/')) ? path + QLatin1Char('/') : path;
+        static const auto slash = QLatin1Char('/');
+        const auto sanitisedPath = path.endsWith(slash) ? path : path + slash;
         _selectiveSyncWhiteList.insert(std::upper_bound(_selectiveSyncWhiteList.begin(), _selectiveSyncWhiteList.end(), sanitisedPath), sanitisedPath);
         return callback(false);
     });