Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorallexzander <blackslayer4@gmail.com>2021-06-08 17:20:07 +0300
committerallexzander <blackslayer4@gmail.com>2021-06-15 14:33:45 +0300
commita3d12a616b589571e5189a97d061c8039484c87b (patch)
tree33ff1acd32b107eac232b691166c34469f563a1b /src/libsync/discovery.cpp
parent6312f6dddeae5c773b4516f92d3c157404951c76 (diff)
Add error message to GUI.
Signed-off-by: allexzander <blackslayer4@gmail.com>
Diffstat (limited to 'src/libsync/discovery.cpp')
-rw-r--r--src/libsync/discovery.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp
index 2f52dbcde..cb9fb7ab3 100644
--- a/src/libsync/discovery.cpp
+++ b/src/libsync/discovery.cpp
@@ -894,22 +894,41 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
_childModified = true;
auto postProcessLocalNew = [item, localEntry, path, this]() {
- if (localEntry.isVirtualFile || localEntry.isDirectory) {
- const bool isPlaceHolder = _discoveryData->_syncOptions._vfs->isDehydratedPlaceholder(_discoveryData->_localDir + path._local);
-
- const bool isNonHydratedVfsFolder = (localEntry.isDirectory
- && _discoveryData->_syncOptions._vfs->mode() != Vfs::Off
- && *_discoveryData->_syncOptions._vfs->availability(path._local) == VfsItemAvailability::OnlineOnly);
+ // TODO: We may want to execute the same logic for non-VFS mode, as, moving/renaming the same folder by 2 or more clients at the same time is not possible in Web UI.
+ // Keeping it like this (for VFS files and folders only) just to fix a user issue.
+ const auto isVfsEnabled = _discoveryData->_syncOptions._vfs && _discoveryData->_syncOptions._vfs->mode() != Vfs::Off;
+ if (localEntry.isVirtualFile || (localEntry.isDirectory && isVfsEnabled)) {
+ // must be a dehydrated placeholder
+ const bool isFilePlaceHolder = !localEntry.isDirectory && _discoveryData->_syncOptions._vfs->isDehydratedPlaceholder(_discoveryData->_localDir + path._local);
+
+ // a folder must be online-only (no files should be hydrated)
+ const bool isFolderPlaceholder = localEntry.isDirectory && *_discoveryData->_syncOptions._vfs->availability(path._local) == VfsItemAvailability::OnlineOnly;
+
+ Q_ASSERT(item->_instruction == CSYNC_INSTRUCTION_NEW);
+ if (item->_instruction != CSYNC_INSTRUCTION_NEW) {
+ qCWarning(lcDisco) << "Wiping virtual file without db entry for" << path._local << ". But, item->_instruction is" << item->_instruction;
+ }
- // must be file placeholder or an online-only folder
- if (isPlaceHolder || isNonHydratedVfsFolder) {
- qCWarning(lcDisco) << "Wiping virtual file without db entry for" << path._local;
+ // must be a file placeholder or an online-only folder placeholder
+ if (isFilePlaceHolder || isFolderPlaceholder) {
+ if (isFolderPlaceholder) {
+ qCInfo(lcDisco) << "Wiping virtual folder without db entry for" << path._local;
+ } else {
+ qCInfo(lcDisco) << "Wiping virtual file without db entry for" << path._local;
+ }
item->_instruction = CSYNC_INSTRUCTION_REMOVE;
item->_direction = SyncFileItem::Down;
+ // this flag needs to be unset, otherwise a folder would get marked as new in the processSubJobs
_childModified = false;
+ if (isFolderPlaceholder && _discoveryData) {
+ emit _discoveryData->addErrorToGui(SyncFileItem::SoftError, tr("Conflict when uploading a folder. It's going to get cleared!"), path._local);
+ }
} else {
- if (localEntry.isDirectory && !isNonHydratedVfsFolder) {
- qCWarning(lcDisco) << "Virtual directory without db entry for" << path._local << "but it is half-hydrated, so, keeping it.";
+ if (localEntry.isDirectory && !isFolderPlaceholder) {
+ qCInfo(lcDisco) << "Virtual directory without db entry for" << path._local << "but it contains hydrated file(s), so let's keep it and reupload.";
+ if (_discoveryData) {
+ emit _discoveryData->addErrorToGui(SyncFileItem::SoftError, tr("Conflict when uploading some files to a folder. Those, conflicted, are going to get cleared!"), path._local);
+ }
return;
}
qCWarning(lcDisco) << "Virtual file without db entry for" << path._local