Skip to content

Commit a514416

Browse files
authored
Merge pull request #9243 from nextcloud/bugfix/reduceLogVerbosity
fix(logs): reduce verbosity when deleting a folder content
2 parents 815a59a + e2f01de commit a514416

File tree

8 files changed

+15
-7
lines changed

8 files changed

+15
-7
lines changed

src/gui/accountsettings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ void AccountSettings::slotEnableVfsCurrentFolder()
962962
folder->setRootPinState(PinState::Unspecified);
963963
for (const auto &entry : oldBlacklist) {
964964
folder->journalDb()->schedulePathForRemoteDiscovery(entry);
965-
if (!folder->vfs().setPinState(entry, PinState::OnlineOnly)) {
965+
if (FileSystem::fileExists(entry) && !folder->vfs().setPinState(entry, PinState::OnlineOnly)) {
966966
qCWarning(lcAccountSettings) << "Could not set pin state of" << entry << "to online only";
967967
}
968968
}

src/gui/folder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ void Folder::slotWatchedPathChanged(const QStringView &path, const ChangeReason
610610
if (_vfs) {
611611
if (pathIsIgnored(path.toString())) {
612612
const auto pinState = _vfs->pinState(relativePath.toString());
613-
if (!pinState || *pinState != PinState::Excluded) {
613+
if ((!pinState || *pinState != PinState::Excluded) && FileSystem::fileExists(relativePath.toString())) {
614614
if (!_vfs->setPinState(relativePath.toString(), PinState::Excluded)) {
615615
qCWarning(lcFolder) << "Could not set pin state of" << relativePath << "to excluded";
616616
}
@@ -646,6 +646,7 @@ void Folder::slotWatchedPathChanged(const QStringView &path, const ChangeReason
646646
qCDebug(lcFolder) << "Changed path was touched by SyncEngine, ignoring:" << path;
647647
return;
648648
}
649+
qCDebug(lcFolder) << "Detected changes in paths:" << path;
649650
#endif
650651

651652
SyncJournalFileRecord record;

src/gui/folderwatcher.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ void FolderWatcher::changeDetected(const QStringList &paths)
279279
return;
280280
}
281281

282-
qCInfo(lcFolderWatcher) << "Detected changes in paths:" << changedPaths;
283282
for (const auto &path : changedPaths) {
284283
emit pathChanged(path);
285284
}

src/gui/folderwatcher_win.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize,
125125
const auto error = GetLastError();
126126
if (longNameSize > 0) {
127127
longfile = QString::fromWCharArray(fileNameBuffer, longNameSize);
128-
} else {
128+
} else if (error != ERROR_FILE_NOT_FOUND) {
129129
qCWarning(lcFolderWatcher) << "Error converting file name" << longfile << "to full length, keeping original name." << Utility::formatWinError(error);
130130
}
131131
}

src/libsync/filesystem.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ bool FileSystem::removeRecursively(const QString &path,
287287
} else {
288288
removeOk = FileSystem::remove(di.filePath(), &removeError);
289289
}
290-
qCInfo(lcFileSystem()) << "delete" << di.filePath();
291290
if (removeOk) {
292291
if (onDeleted)
293292
onDeleted(di.filePath(), false);
@@ -330,7 +329,6 @@ bool FileSystem::removeRecursively(const QString &path,
330329
allRemoved = false;
331330
}
332331

333-
qCInfo(lcFileSystem()) << "delete" << path;
334332
if (allRemoved) {
335333
if (onDeleted)
336334
onDeleted(path, true);

src/libsync/propagatorjobs.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ bool PropagateLocalRemove::removeRecursively(const QString &path)
5353
const auto fileInfo = QFileInfo{absolute};
5454
const auto parentFolderPath = fileInfo.dir().absolutePath();
5555
const auto parentPermissionsHandler = FileSystem::FilePermissionsRestore{parentFolderPath, FileSystem::FolderPermissions::ReadWrite};
56+
57+
qCInfo(lcPropagateLocalRemove()) << "delete" << absolute;
58+
59+
Q_EMIT propagator()->touchedFile(absolute);
60+
5661
const auto success = FileSystem::removeRecursively(absolute,
5762
[&deleted](const QString &path, bool isDir) {
5863
// by prepending, a folder deletion may be followed by content deletions
@@ -63,7 +68,6 @@ bool PropagateLocalRemove::removeRecursively(const QString &path)
6368
[this] (const QString &itemPath, QString *removeError) -> bool {
6469
auto result = false;
6570

66-
qCInfo(lcPropagateLocalRemove()) << itemPath << _deleteToClientTrashBin;
6771
if (_deleteToClientTrashBin.contains(itemPath)) {
6872
result = FileSystem::moveToTrash(itemPath, removeError);
6973
if (!result) {

src/libsync/syncengine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,8 @@ void SyncEngine::handleRemnantReadOnlyFolders()
11711171
const auto deletionCallback = [this] (const QString &deleteItem, bool) {
11721172
slotAddTouchedFile(deleteItem);
11731173
};
1174+
1175+
qCInfo(lcEngine()) << "delete" << _localPath + oneFolder->_file;
11741176
FileSystem::removeRecursively(_localPath + oneFolder->_file, deletionCallback, nullptr, deletionCallback);
11751177
} else {
11761178
FileSystem::remove(_localPath + oneFolder->_file);

src/libsync/vfs/cfapi/cfapiwrapper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,10 @@ OCC::CfApiWrapper::FileHandle OCC::CfApiWrapper::handleForPath(const QString &pa
10131013

10141014
OCC::CfApiWrapper::PlaceHolderInfo OCC::CfApiWrapper::findPlaceholderInfo(const QString &path)
10151015
{
1016+
if (!FileSystem::fileExists(path)) {
1017+
return {};
1018+
}
1019+
10161020
if (auto handle = handleForPath(path)) {
10171021
std::vector<char> buffer(512);
10181022
DWORD actualSize = {};

0 commit comments

Comments
 (0)