Skip to content

Commit

Permalink
ensure we can delete invalid read-only items
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien authored and backportbot[bot] committed Feb 21, 2025
1 parent 2d0e585 commit 12acc76
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 12acc76

Please sign in to comment.