Skip to content

Commit a25dc6a

Browse files
authored
Merge pull request #7713 from nextcloud/bugfix/doNotAlwaysFreeUpStorageWindowsShortcuts
Bugfix/do not always free up storage windows shortcuts
2 parents 1e91c0e + 6f8a40f commit a25dc6a

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/libsync/discovery.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,8 @@ void ProcessDirectoryJob::processFileFinalize(
16721672
if (_discoveryData->_syncOptions._vfs &&
16731673
(item->_type == CSyncEnums::ItemTypeFile || item->_type == CSyncEnums::ItemTypeDirectory) &&
16741674
item->_instruction == CSyncEnums::CSYNC_INSTRUCTION_NONE &&
1675-
FileSystem::isLnkFile((_discoveryData->_localDir + path._local))) {
1675+
FileSystem::isLnkFile((_discoveryData->_localDir + path._local)) &&
1676+
!_discoveryData->_syncOptions._vfs->isPlaceHolderInSync(_discoveryData->_localDir + path._local)) {
16761677
item->_instruction = CSyncEnums::CSYNC_INSTRUCTION_SYNC;
16771678
item->_direction = SyncFileItem::Down;
16781679
item->_type = CSyncEnums::ItemTypeVirtualFileDehydration;
@@ -2204,20 +2205,24 @@ void ProcessDirectoryJob::setupDbPinStateActions(SyncJournalFileRecord &record)
22042205
{
22052206
// Only suffix-vfs uses the db for pin states.
22062207
// Other plugins will set localEntry._type according to the file's pin state.
2207-
if (!isVfsWithSuffix())
2208+
if (!isVfsWithSuffix()) {
22082209
return;
2210+
}
22092211

22102212
auto pin = _discoveryData->_statedb->internalPinStates().rawForPath(record._path);
2211-
if (!pin || *pin == PinState::Inherited)
2213+
if (!pin || *pin == PinState::Inherited) {
22122214
pin = _pinState;
2215+
}
22132216

22142217
// OnlineOnly hydrated files want to be dehydrated
2215-
if (record._type == ItemTypeFile && *pin == PinState::OnlineOnly)
2218+
if (record._type == ItemTypeFile && *pin == PinState::OnlineOnly) {
22162219
record._type = ItemTypeVirtualFileDehydration;
2220+
}
22172221

22182222
// AlwaysLocal dehydrated files want to be hydrated
2219-
if (record._type == ItemTypeVirtualFile && *pin == PinState::AlwaysLocal)
2223+
if (record._type == ItemTypeVirtualFile && *pin == PinState::AlwaysLocal) {
22202224
record._type = ItemTypeVirtualFileDownload;
2225+
}
22212226
}
22222227

22232228
}

src/libsync/propagatorjobs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void PropagateLocalRemove::start()
118118

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

0 commit comments

Comments
 (0)