Skip to content

Commit

Permalink
Merge pull request #7779 from nextcloud/bugfix/readOnlyClassicalSyncL…
Browse files Browse the repository at this point in the history
…nkShortcutsWindows

Bugfix/read only classical sync lnk shortcuts windows
  • Loading branch information
mgallien authored Jan 22, 2025
2 parents a66a5cd + 7c3ac18 commit 76075b6
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1662,14 +1662,14 @@ void ProcessDirectoryJob::processFileFinalize(
}
}

if (_discoveryData->_syncOptions._vfs &&
if (_discoveryData->_syncOptions._vfs && _discoveryData->_syncOptions._vfs->mode() != OCC::Vfs::Off &&
(item->_type == CSyncEnums::ItemTypeFile || item->_type == CSyncEnums::ItemTypeDirectory) &&
item->_instruction == CSyncEnums::CSYNC_INSTRUCTION_NONE &&
!_discoveryData->_syncOptions._vfs->isPlaceHolderInSync(_discoveryData->_localDir + path._local)) {
item->_instruction = CSyncEnums::CSYNC_INSTRUCTION_UPDATE_VFS_METADATA;
}

if (_discoveryData->_syncOptions._vfs &&
if (_discoveryData->_syncOptions._vfs && _discoveryData->_syncOptions._vfs->mode() != OCC::Vfs::Off &&
(item->_type == CSyncEnums::ItemTypeFile || item->_type == CSyncEnums::ItemTypeDirectory) &&
item->_instruction == CSyncEnums::CSYNC_INSTRUCTION_NONE &&
FileSystem::isLnkFile((_discoveryData->_localDir + path._local)) &&
Expand All @@ -1679,6 +1679,18 @@ void ProcessDirectoryJob::processFileFinalize(
item->_type = CSyncEnums::ItemTypeVirtualFileDehydration;
}

if (item->_instruction != CSyncEnums::CSYNC_INSTRUCTION_NONE &&
!item->isDirectory() &&
_discoveryData->_syncOptions._vfs &&
_discoveryData->_syncOptions._vfs->mode() == OCC::Vfs::Off &&
(item->_type == CSyncEnums::ItemTypeVirtualFile ||
item->_type == CSyncEnums::ItemTypeVirtualFileDownload ||
item->_type == CSyncEnums::ItemTypeVirtualFileDehydration)) {
item->_instruction = CSyncEnums::CSYNC_INSTRUCTION_UPDATE_METADATA;
item->_direction = SyncFileItem::Down;
item->_type = CSyncEnums::ItemTypeFile;
}

if (path._original != path._target && (item->_instruction == CSYNC_INSTRUCTION_UPDATE_VFS_METADATA || item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA || item->_instruction == CSYNC_INSTRUCTION_NONE)) {
ASSERT(_dirItem && _dirItem->_instruction == CSYNC_INSTRUCTION_RENAME);
// This is because otherwise subitems are not updated! (ideally renaming a directory could
Expand Down Expand Up @@ -1712,6 +1724,16 @@ void ProcessDirectoryJob::processFileFinalize(
} else {
recurse = false;
}

if (!(item->isDirectory() ||
(!_discoveryData->_syncOptions._vfs || _discoveryData->_syncOptions._vfs->mode() != OCC::Vfs::Off) ||
item->_type != CSyncEnums::ItemTypeVirtualFile ||
item->_type != CSyncEnums::ItemTypeVirtualFileDownload ||
item->_type != CSyncEnums::ItemTypeVirtualFileDehydration)) {
qCCritical(lcDisco()) << "wong item type for" << item->_file << item->_type;
Q_ASSERT(false);
}

if (recurse) {
auto job = new ProcessDirectoryJob(path, item, recurseQueryLocal, recurseQueryServer,
_lastSyncTimestamp, this);
Expand Down

0 comments on commit 76075b6

Please sign in to comment.