From b724221707b592fb8176bb4f151113798943751b Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 11 Jan 2024 00:16:43 +0100 Subject: [PATCH] newly created folders will be read-only when needed Close #6296 Signed-off-by: Matthieu Gallien --- src/libsync/propagatorjobs.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index 9749f5a1d0b79..937c6f5e70b16 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -32,6 +32,7 @@ #include #include +#include #include @@ -188,6 +189,10 @@ void PropagateLocalMkdir::startLocalMkdir() return; } + if (!_item->_remotePerm.isNull() && !_item->_remotePerm.hasPermission(RemotePermissions::CanAddFile) && !_item->_remotePerm.hasPermission(RemotePermissions::CanAddSubDirectories)) { + std::filesystem::permissions(newDirStr.toStdWString(), std::filesystem::perms::owner_write | std::filesystem::perms::group_write | std::filesystem::perms::owner_write, std::filesystem::perm_options::remove); + } + // Insert the directory into the database. The correct etag will be set later, // once all contents have been propagated, because should_update_metadata is true. // Adding an entry with a dummy etag to the database still makes sense here