Skip to content

Commit 76075b6

Browse files
authored
Merge pull request #7779 from nextcloud/bugfix/readOnlyClassicalSyncLnkShortcutsWindows
Bugfix/read only classical sync lnk shortcuts windows
2 parents a66a5cd + 7c3ac18 commit 76075b6

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/libsync/discovery.cpp

+24-2
Original file line numberDiff line numberDiff line change
@@ -1662,14 +1662,14 @@ void ProcessDirectoryJob::processFileFinalize(
16621662
}
16631663
}
16641664

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

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

1682+
if (item->_instruction != CSyncEnums::CSYNC_INSTRUCTION_NONE &&
1683+
!item->isDirectory() &&
1684+
_discoveryData->_syncOptions._vfs &&
1685+
_discoveryData->_syncOptions._vfs->mode() == OCC::Vfs::Off &&
1686+
(item->_type == CSyncEnums::ItemTypeVirtualFile ||
1687+
item->_type == CSyncEnums::ItemTypeVirtualFileDownload ||
1688+
item->_type == CSyncEnums::ItemTypeVirtualFileDehydration)) {
1689+
item->_instruction = CSyncEnums::CSYNC_INSTRUCTION_UPDATE_METADATA;
1690+
item->_direction = SyncFileItem::Down;
1691+
item->_type = CSyncEnums::ItemTypeFile;
1692+
}
1693+
16821694
if (path._original != path._target && (item->_instruction == CSYNC_INSTRUCTION_UPDATE_VFS_METADATA || item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA || item->_instruction == CSYNC_INSTRUCTION_NONE)) {
16831695
ASSERT(_dirItem && _dirItem->_instruction == CSYNC_INSTRUCTION_RENAME);
16841696
// This is because otherwise subitems are not updated! (ideally renaming a directory could
@@ -1712,6 +1724,16 @@ void ProcessDirectoryJob::processFileFinalize(
17121724
} else {
17131725
recurse = false;
17141726
}
1727+
1728+
if (!(item->isDirectory() ||
1729+
(!_discoveryData->_syncOptions._vfs || _discoveryData->_syncOptions._vfs->mode() != OCC::Vfs::Off) ||
1730+
item->_type != CSyncEnums::ItemTypeVirtualFile ||
1731+
item->_type != CSyncEnums::ItemTypeVirtualFileDownload ||
1732+
item->_type != CSyncEnums::ItemTypeVirtualFileDehydration)) {
1733+
qCCritical(lcDisco()) << "wong item type for" << item->_file << item->_type;
1734+
Q_ASSERT(false);
1735+
}
1736+
17151737
if (recurse) {
17161738
auto job = new ProcessDirectoryJob(path, item, recurseQueryLocal, recurseQueryServer,
17171739
_lastSyncTimestamp, this);

0 commit comments

Comments
 (0)