From 3e397e664db079bc531037aba30aeb09337755b8 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 22 Aug 2024 14:50:26 +0200 Subject: [PATCH] enable users to delete unexpected new folders inside a read-only folder let unexpected new folders in read-only folders be read-write would be done for folders that are inside a read-only folder and cannot be uploaded because the parent folder is realy read-only most probably those folders should never have been there in case they would be read-only, users cannot delete them, in such situation, letting them be read-write again should really help Signed-off-by: Matthieu Gallien --- src/libsync/discovery.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 037874d25a..a23291fe45 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -1828,6 +1828,9 @@ bool ProcessDirectoryJob::checkPermissions(const OCC::SyncFileItemPtr &item) qCWarning(lcDisco) << "checkForPermission: ERROR" << item->_file; item->_instruction = CSYNC_INSTRUCTION_ERROR; item->_errorString = tr("Not allowed because you don't have permission to add subfolders to that folder"); + const auto localPath = QString{_discoveryData->_localDir + item->_file}; + qCWarning(lcDisco) << "unexpected new folder in a read-only folder will be made read-write" << localPath; + FileSystem::setFolderPermissions(localPath, FileSystem::FolderPermissions::ReadWrite); return false; } else if (!item->isDirectory() && !perms.hasPermission(RemotePermissions::CanAddFile)) { qCWarning(lcDisco) << "checkForPermission: ERROR" << item->_file; @@ -2029,6 +2032,9 @@ int ProcessDirectoryJob::processSubJobs(int nbJobs) qCWarning(lcDisco) << "checkForPermission: ERROR" << _dirItem->_file; _dirItem->_instruction = CSYNC_INSTRUCTION_ERROR; _dirItem->_errorString = tr("Not allowed because you don't have permission to add subfolders to that folder"); + const auto localPath = QString{_discoveryData->_localDir + _dirItem->_file}; + qCWarning(lcDisco) << "unexpected new folder in a read-only folder will be made read-write" << localPath; + FileSystem::setFolderPermissions(localPath, FileSystem::FolderPermissions::ReadWrite); } _dirItem->_direction = _dirItem->_direction == SyncFileItem::Up ? SyncFileItem::Down : SyncFileItem::Up;