fix(readonly): enable MOVE rollback when folder is read-only

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2025-05-07 14:37:43 +02:00
parent 85474628f8
commit de546bd549

View File

@ -201,7 +201,9 @@ void PropagateRemoteMove::slotMoveJobFinished()
&propagator()->_anotherSyncNeeded);
const auto filePath = propagator()->fullLocalPath(_item->_renameTarget);
const auto filePathOriginal = propagator()->fullLocalPath(_item->_originalFile);
const auto oldFile = QFileInfo{filePathOriginal};
QFile file(filePath);
auto permissionsHandler = FileSystem::FilePermissionsRestore{oldFile.absolutePath(), FileSystem::FolderPermissions::ReadWrite};
if (!file.rename(filePathOriginal)) {
qCWarning(lcPropagateRemoteMove) << "Could not MOVE file" << filePathOriginal << " to" << filePath
<< " with error:" << _job->errorString() << " and failed to restore it !";