diff options
author | Camila <hello@camila.codes> | 2020-11-26 14:51:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-26 14:51:53 +0300 |
commit | 4d133ba9a5ce990e8d4de7d700cd8f959823cae8 (patch) | |
tree | b44cbec79fdf216a254feb9d0c1cd21d63644b93 | |
parent | 820ab125613bee8ece04f96207ecad62818c204d (diff) | |
parent | bdd3465e7b3368d04358247c779ef2b47bb116c4 (diff) |
Merge pull request #2540 from nextcloud/fix-issue-1458
Add last / to exclude list file path.
-rw-r--r-- | src/csync/csync_exclude.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index dadd611bf..61bfdd443 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -317,17 +317,20 @@ bool ExcludedFiles::loadExcludeFile(const QByteArray & basePath, const QString & if (!f.open(QIODevice::ReadOnly)) return false; + QList<QByteArray> patterns; while (!f.atEnd()) { QByteArray line = f.readLine().trimmed(); if (line.isEmpty() || line.startsWith('#')) continue; csync_exclude_expand_escapes(line); - _allExcludes[basePath].append(line); + patterns.append(line); } + _allExcludes.insert(basePath, patterns); // nothing to prepare if the user decided to not exclude anything - if(_allExcludes.size()) + if (!_allExcludes.value(basePath).isEmpty()){ prepare(basePath); + } return true; } @@ -411,10 +414,12 @@ CSYNC_EXCLUDE_TYPE ExcludedFiles::traversalPatternMatch(const char *path, ItemTy // Directories are guaranteed to be visited before their files if (filetype == ItemTypeDirectory) { - QFileInfo fi = QFileInfo(_localPath + path + "/.sync-exclude.lst"); + const auto basePath = QString(_localPath + path + QLatin1Char('/')).toUtf8(); + const auto fi = QFileInfo(basePath + QStringLiteral(".sync-exclude.lst")); + if (fi.isReadable()) { addInTreeExcludeFilePath(fi.absoluteFilePath()); - loadExcludeFile(fi.absolutePath().toUtf8(), fi.absoluteFilePath()); + loadExcludeFile(basePath, fi.absoluteFilePath()); } } |