when deleting a folder starts by making it read-write permissions

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2025-04-04 16:37:11 +02:00 committed by backportbot[bot]
parent bf1a13913a
commit b97f7eb84c
2 changed files with 2 additions and 1 deletions

View File

@ -259,6 +259,8 @@ qint64 FileSystem::getSize(const QString &filename)
// Code inspired from Qt5's QDir::removeRecursively
bool FileSystem::removeRecursively(const QString &path, const std::function<void(const QString &path, bool isDir)> &onDeleted, QStringList *errors)
{
FileSystem::setFolderPermissions(path, FileSystem::FolderPermissions::ReadWrite);
bool allRemoved = true;
QDirIterator di(path, QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);

View File

@ -63,7 +63,6 @@ bool PropagateLocalRemove::removeRecursively(const QString &path)
const auto fileInfo = QFileInfo{absolute};
const auto parentFolderPath = fileInfo.dir().absolutePath();
const auto parentPermissionsHandler = FileSystem::FilePermissionsRestore{parentFolderPath, FileSystem::FolderPermissions::ReadWrite};
FileSystem::setFolderPermissions(absolute, FileSystem::FolderPermissions::ReadWrite);
bool success = FileSystem::removeRecursively(
absolute,
[&deleted](const QString &path, bool isDir) {