fix regressions on pinState management when doing renames

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2022-11-23 18:04:46 +01:00 committed by Matthieu Gallien
parent 0fcd7f76b3
commit 60566eec00
6 changed files with 22 additions and 9 deletions

View file

@ -251,7 +251,7 @@ void PropagateRemoteMove::finalize()
return;
}
auto &vfs = propagator()->syncOptions()._vfs;
auto pinState = vfs->pinState(_item->_renameTarget);
auto pinState = vfs->pinState(_item->_originalFile);
const auto targetFile = propagator()->fullLocalPath(_item->_renameTarget);

View file

@ -277,7 +277,7 @@ void PropagateLocalRename::start()
return;
}
if (pinState != OCC::PinState::Unspecified && !vfs->setPinState(_item->_renameTarget, pinState)) {
if (!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;

View file

@ -289,6 +289,8 @@ bool VfsCfApi::statTypeVirtualFile(csync_file_stat_t *stat, void *statData)
bool VfsCfApi::setPinState(const QString &folderPath, PinState state)
{
qCDebug(lcCfApi) << "setPinState" << folderPath << state;
const auto localPath = QDir::toNativeSeparators(params().filesystemPath + folderPath);
if (cfapi::setPinState(localPath, state, cfapi::Recurse)) {

View file

@ -14,12 +14,15 @@
#include "vfs_suffix.h"
#include <QFile>
#include "syncfileitem.h"
#include "filesystem.h"
#include "common/syncjournaldb.h"
#include <QFile>
#include <QLoggingCategory>
Q_LOGGING_CATEGORY(lcVfsSuffix, "nextcloud.sync.vfs.suffix", QtInfoMsg)
namespace OCC {
VfsSuffix::VfsSuffix(QObject *parent)
@ -158,6 +161,12 @@ bool VfsSuffix::statTypeVirtualFile(csync_file_stat_t *stat, void *)
return false;
}
bool VfsSuffix::setPinState(const QString &folderPath, PinState state)
{
qCDebug(lcVfsSuffix) << "setPinState" << folderPath << state;
return setPinStateInDb(folderPath, state);
}
Vfs::AvailabilityResult VfsSuffix::availability(const QString &folderPath)
{
return availabilityInDb(folderPath);

View file

@ -48,8 +48,7 @@ public:
bool isDehydratedPlaceholder(const QString &filePath) override;
bool statTypeVirtualFile(csync_file_stat_t *stat, void *stat_data) override;
bool setPinState(const QString &folderPath, PinState state) override
{ return setPinStateInDb(folderPath, state); }
bool setPinState(const QString &folderPath, PinState state) override;
Optional<PinState> pinState(const QString &folderPath) override
{ return pinStateInDb(folderPath); }
AvailabilityResult availability(const QString &folderPath) override;

View file

@ -14,14 +14,16 @@
#include "vfs_xattr.h"
#include <QFile>
#include "syncfileitem.h"
#include "filesystem.h"
#include "common/syncjournaldb.h"
#include "xattrwrapper.h"
#include <QFile>
#include <QLoggingCategory>
Q_LOGGING_CATEGORY(lcVfsXAttr, "nextcloud.sync.vfs.xattr", QtInfoMsg)
namespace xattr {
using namespace OCC::XAttrWrapper;
}
@ -172,6 +174,7 @@ bool VfsXAttr::statTypeVirtualFile(csync_file_stat_t *stat, void *statData)
bool VfsXAttr::setPinState(const QString &folderPath, PinState state)
{
qCDebug(lcVfsXAttr) << "setPinState" << folderPath << state;
return setPinStateInDb(folderPath, state);
}