Merge pull request #7909 from nextcloud/backport/7908/stable-3.16

[stable-3.16] Bugfix/delete read only remnants
This commit is contained in:
Jyrki Gadinger 2025-02-22 12:13:02 +01:00 committed by GitHub
commit 620f55e89e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1736,7 +1736,16 @@ void Folder::slotNeedToRemoveRemnantsReadOnlyFolders(const QList<SyncFileItemPtr
setSyncPaused(true);
for(const auto &oneFolder : folders) {
FileSystem::removeRecursively(localPath + oneFolder->_file);
#if !defined(Q_OS_MACOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15
const auto fileInfo = QFileInfo{localPath + oneFolder->_file};
const auto parentFolderPath = fileInfo.dir().absolutePath();
const auto parentPermissionsHandler = FileSystem::FilePermissionsRestore{parentFolderPath, FileSystem::FolderPermissions::ReadWrite};
#endif
if (oneFolder->_type == ItemType::ItemTypeDirectory) {
FileSystem::removeRecursively(localPath + oneFolder->_file);
} else {
FileSystem::remove(localPath + oneFolder->_file);
}
}
callback(true);
setSyncPaused(false);