mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
fix many errors when querying/setting pin state of virtual files
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
a00ec1aaa5
commit
361db77d3c
3 changed files with 14 additions and 11 deletions
|
@ -1871,7 +1871,7 @@ bool ProcessDirectoryJob::isVfsWithSuffix() const
|
|||
void ProcessDirectoryJob::computePinState(PinState parentState)
|
||||
{
|
||||
_pinState = parentState;
|
||||
if (_queryLocal != ParentDontExist) {
|
||||
if (_queryLocal != ParentDontExist && QFileInfo::exists(_discoveryData->_localDir + _currentFolder._local)) {
|
||||
if (auto state = _discoveryData->_syncOptions._vfs->pinState(_currentFolder._local)) // ouch! pin local or original?
|
||||
_pinState = *state;
|
||||
}
|
||||
|
|
|
@ -251,7 +251,7 @@ void PropagateRemoteMove::finalize()
|
|||
return;
|
||||
}
|
||||
auto &vfs = propagator()->syncOptions()._vfs;
|
||||
auto pinState = vfs->pinState(_item->_originalFile);
|
||||
auto pinState = vfs->pinState(_item->_renameTarget);
|
||||
|
||||
const auto targetFile = propagator()->fullLocalPath(_item->_renameTarget);
|
||||
|
||||
|
|
|
@ -222,11 +222,19 @@ void PropagateLocalRename::start()
|
|||
if (propagator()->_abortRequested)
|
||||
return;
|
||||
|
||||
auto &vfs = propagator()->syncOptions()._vfs;
|
||||
const auto previousNameInDb = propagator()->adjustRenamedPath(_item->_file);
|
||||
const auto existingFile = propagator()->fullLocalPath(propagator()->adjustRenamedPath(_item->_file));
|
||||
const auto targetFile = propagator()->fullLocalPath(_item->_renameTarget);
|
||||
|
||||
const auto fileAlreadyMoved = !QFileInfo::exists(propagator()->fullLocalPath(_item->_originalFile));
|
||||
auto pinState = OCC::PinState::Unspecified;
|
||||
if (!fileAlreadyMoved) {
|
||||
auto pinStateResult = vfs->pinState(propagator()->adjustRenamedPath(_item->_file));
|
||||
if (pinStateResult) {
|
||||
pinState = pinStateResult.get();
|
||||
}
|
||||
}
|
||||
|
||||
// if the file is a file underneath a moved dir, the _item->file is equal
|
||||
// to _item->renameTarget and the file is not moved as a result.
|
||||
|
@ -269,10 +277,10 @@ void PropagateLocalRename::start()
|
|||
return;
|
||||
}
|
||||
|
||||
auto &vfs = propagator()->syncOptions()._vfs;
|
||||
auto pinState = vfs->pinState(_item->_renameTarget);
|
||||
if (!vfs->setPinState(_item->_renameTarget, PinState::Inherited)) {
|
||||
qCWarning(lcPropagateLocalRename) << "Could not set pin state of" << _item->_renameTarget << "to inherited";
|
||||
if (pinState != OCC::PinState::Unspecified && !vfs->setPinState(_item->_renameTarget, pinState)) {
|
||||
qCWarning(lcPropagateLocalRename) << "Could not set pin state of" << _item->_renameTarget << "to old value" << pinState;
|
||||
done(SyncFileItem::NormalError, tr("Error setting pin state"));
|
||||
return;
|
||||
}
|
||||
|
||||
const auto oldFile = _item->_file;
|
||||
|
@ -331,11 +339,6 @@ void PropagateLocalRename::start()
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (pinState && *pinState != PinState::Inherited
|
||||
&& !vfs->setPinState(_item->_renameTarget, *pinState)) {
|
||||
done(SyncFileItem::NormalError, tr("Error setting pin state"));
|
||||
return;
|
||||
}
|
||||
|
||||
propagator()->_journal->commit("localRename");
|
||||
|
||||
|
|
Loading…
Reference in a new issue