Skip to content

Commit

Permalink
avoid showing warnings for excluded files to not confuse users
Browse files Browse the repository at this point in the history
if a file name is invalid, the files will be ignored

if a file is excluded because of selective sync, the file will be
ignored

if a file is ignored for those both reasons, avoid showing a very
visible warning to the user

will limit too many warnings and notifications being shown

Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Mar 7, 2025
1 parent ad22498 commit 6234375
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,16 @@ void ProcessDirectoryJob::process()
checkAndUpdateSelectiveSyncListsForE2eeFolders(path._server + "/");
}

if (_queryServer == InBlackList || _discoveryData->isInSelectiveSyncBlackList(path._original) || isEncryptedFolderButE2eIsNotSetup) {
processBlacklisted(path, e.localEntry, e.dbEntry);
const auto isBlacklisted = _queryServer == InBlackList || _discoveryData->isInSelectiveSyncBlackList(path._original) || isEncryptedFolderButE2eIsNotSetup;

const auto willBeExcluded = handleExcluded(path._target, e, entries, isHidden, isBlacklisted);

if (willBeExcluded) {
continue;
}

if (handleExcluded(path._target, e, entries, isHidden)) {
if (isBlacklisted) {
processBlacklisted(path, e.localEntry, e.dbEntry);
continue;
}

Expand All @@ -266,7 +270,7 @@ void ProcessDirectoryJob::process()
QTimer::singleShot(0, _discoveryData, &DiscoveryPhase::scheduleMoreJobs);
}

bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &entries, const std::map<QString, Entries> &allEntries, bool isHidden)
bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &entries, const std::map<QString, Entries> &allEntries, const bool isHidden, const bool isBlacklisted)
{
const auto isDirectory = entries.localEntry.isDirectory || entries.serverEntry.isDirectory;

Expand Down Expand Up @@ -497,7 +501,13 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent
}

_childIgnored = true;
emit _discoveryData->itemDiscovered(item);

if (isBlacklisted) {
emit _discoveryData->silentlyExcluded(path);
} else {
emit _discoveryData->itemDiscovered(item);
}

return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/libsync/discovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class ProcessDirectoryJob : public QObject

// return true if the file is excluded.
// path is the full relative path of the file. localName is the base name of the local entry.
bool handleExcluded(const QString &path, const Entries &entries, const std::map<QString, Entries> &allEntries, bool isHidden);
bool handleExcluded(const QString &path, const Entries &entries, const std::map<QString, Entries> &allEntries, bool isHidden, bool isBlacklisted);

bool canRemoveCaseClashConflictedCopy(const QString &path, const std::map<QString, Entries> &allEntries);

Expand Down

0 comments on commit 6234375

Please sign in to comment.