From db58703fc08672fd0ebd2d88db09c93cc71dc976 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 15 May 2025 12:30:25 +0200 Subject: [PATCH] fix(delete): fix move to trash when parent folder is read-only Signed-off-by: Matthieu Gallien --- src/libsync/propagatorjobs.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index 23fe245110..4886d0991b 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -101,6 +101,9 @@ void PropagateLocalRemove::start() if (_moveToTrash && propagator()->syncOptions()._vfs->mode() != OCC::Vfs::WindowsCfApi) { const auto fileInfo = QFileInfo{filename}; if (FileSystem::fileExists(filename, fileInfo)) { + const auto parentFolderPath = fileInfo.dir().absolutePath(); + const auto parentPermissionsHandler = FileSystem::FilePermissionsRestore{parentFolderPath, FileSystem::FolderPermissions::ReadWrite}; + if (!FileSystem::moveToTrash(filename, &removeError)) { qCWarning(lcPropagateLocalRemove()) << "move to trash failed" << filename << removeError; done(SyncFileItem::NormalError, tr("Temporary error when removing local item removed from server."), ErrorCategory::GenericError);