Skip to content

Commit

Permalink
enable users to delete unexpected new folders inside a read-only folder
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mgallien committed Aug 22, 2024
1 parent 389228b commit 589ad42
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1779,6 +1779,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;
Expand Down Expand Up @@ -1980,6 +1983,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;
Expand Down

0 comments on commit 589ad42

Please sign in to comment.