Skip to content

Commit

Permalink
update metadata when a file item has wrong type in DB
Browse files Browse the repository at this point in the history
should help fixing the type of windows shortcuts in DB that were wrongly
set as virtual files

Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Jan 21, 2025
1 parent 18b5582 commit f69c998
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f69c998

Please sign in to comment.