mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 13:05:51 +03:00
Ensure we are re-adding same permissions as removed
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
b34a89a653
commit
c34edbee82
1 changed files with 3 additions and 2 deletions
|
@ -318,10 +318,11 @@ bool FileSystem::getInode(const QString &filename, quint64 *inode)
|
|||
bool FileSystem::setFolderPermissions(const QString &path,
|
||||
FileSystem::FolderPermissions permissions) noexcept
|
||||
{
|
||||
static constexpr auto writePerms = std::filesystem::perms::owner_write | std::filesystem::perms::group_write | std::filesystem::perms::others_write;
|
||||
try {
|
||||
switch (permissions) {
|
||||
case OCC::FileSystem::FolderPermissions::ReadOnly:
|
||||
std::filesystem::permissions(path.toStdWString(), std::filesystem::perms::owner_write | std::filesystem::perms::group_write | std::filesystem::perms::others_write, std::filesystem::perm_options::remove);
|
||||
std::filesystem::permissions(path.toStdWString(), writePerms, std::filesystem::perm_options::remove);
|
||||
break;
|
||||
case OCC::FileSystem::FolderPermissions::ReadWrite:
|
||||
break;
|
||||
|
@ -457,7 +458,7 @@ bool FileSystem::setFolderPermissions(const QString &path,
|
|||
case OCC::FileSystem::FolderPermissions::ReadOnly:
|
||||
break;
|
||||
case OCC::FileSystem::FolderPermissions::ReadWrite:
|
||||
std::filesystem::permissions(path.toStdWString(), std::filesystem::perms::owner_write, std::filesystem::perm_options::add);
|
||||
std::filesystem::permissions(path.toStdWString(), writePerms, std::filesystem::perm_options::add);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue