Merge pull request #7713 from nextcloud/bugfix/doNotAlwaysFreeUpStorageWindowsShortcuts

Bugfix/do not always free up storage windows shortcuts
This commit is contained in:
Matthieu Gallien 2025-01-03 17:14:37 +01:00 committed by GitHub
commit a25dc6ab25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View File

@ -1672,7 +1672,8 @@ void ProcessDirectoryJob::processFileFinalize(
if (_discoveryData->_syncOptions._vfs &&
(item->_type == CSyncEnums::ItemTypeFile || item->_type == CSyncEnums::ItemTypeDirectory) &&
item->_instruction == CSyncEnums::CSYNC_INSTRUCTION_NONE &&
FileSystem::isLnkFile((_discoveryData->_localDir + path._local))) {
FileSystem::isLnkFile((_discoveryData->_localDir + path._local)) &&
!_discoveryData->_syncOptions._vfs->isPlaceHolderInSync(_discoveryData->_localDir + path._local)) {
item->_instruction = CSyncEnums::CSYNC_INSTRUCTION_SYNC;
item->_direction = SyncFileItem::Down;
item->_type = CSyncEnums::ItemTypeVirtualFileDehydration;
@ -2204,20 +2205,24 @@ void ProcessDirectoryJob::setupDbPinStateActions(SyncJournalFileRecord &record)
{
// Only suffix-vfs uses the db for pin states.
// Other plugins will set localEntry._type according to the file's pin state.
if (!isVfsWithSuffix())
if (!isVfsWithSuffix()) {
return;
}
auto pin = _discoveryData->_statedb->internalPinStates().rawForPath(record._path);
if (!pin || *pin == PinState::Inherited)
if (!pin || *pin == PinState::Inherited) {
pin = _pinState;
}
// OnlineOnly hydrated files want to be dehydrated
if (record._type == ItemTypeFile && *pin == PinState::OnlineOnly)
if (record._type == ItemTypeFile && *pin == PinState::OnlineOnly) {
record._type = ItemTypeVirtualFileDehydration;
}
// AlwaysLocal dehydrated files want to be hydrated
if (record._type == ItemTypeVirtualFile && *pin == PinState::AlwaysLocal)
if (record._type == ItemTypeVirtualFile && *pin == PinState::AlwaysLocal) {
record._type = ItemTypeVirtualFileDownload;
}
}
}

View File

@ -118,7 +118,7 @@ void PropagateLocalRemove::start()
QString removeError;
const auto availability = propagator()->syncOptions()._vfs->availability(_item->_file, Vfs::AvailabilityRecursivity::RecursiveAvailability);
if (_moveToTrash && (!availability || (*availability != VfsItemAvailability::AllDehydrated && *availability != VfsItemAvailability::OnlineOnly && *availability != VfsItemAvailability::Mixed))) {
if (_moveToTrash && propagator()->syncOptions()._vfs->mode() != OCC::Vfs::WindowsCfApi) {
if ((QDir(filename).exists() || FileSystem::fileExists(filename))
&& !FileSystem::moveToTrash(filename, &removeError)) {
done(SyncFileItem::NormalError, removeError, ErrorCategory::GenericError);