From: Matthieu Gallien Date: Fri, 6 Sep 2024 14:02:38 +0000 (+0200) Subject: add missing exception handling X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~6^2~32^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8f139ac2de6e3b0af462788b7244f82cdb14a2e9;p=nextcloud-desktop.git add missing exception handling Signed-off-by: Matthieu Gallien --- diff --git a/src/libsync/filesystem.cpp b/src/libsync/filesystem.cpp index baafe2225..d24962337 100644 --- a/src/libsync/filesystem.cpp +++ b/src/libsync/filesystem.cpp @@ -484,11 +484,15 @@ bool FileSystem::isFolderReadOnly(const std::filesystem::path &path) noexcept FileSystem::FilePermissionsRestore::FilePermissionsRestore(const QString &path, FolderPermissions temporaryPermissions) : _path(path) { - const auto stdStrPath = _path.toStdWString(); - _initialPermissions = FileSystem::isFolderReadOnly(stdStrPath) ? OCC::FileSystem::FolderPermissions::ReadOnly : OCC::FileSystem::FolderPermissions::ReadWrite; - if (_initialPermissions != temporaryPermissions) { - _rollbackNeeded = true; - FileSystem::setFolderPermissions(_path, temporaryPermissions); + try { + const auto stdStrPath = _path.toStdWString(); + _initialPermissions = FileSystem::isFolderReadOnly(stdStrPath) ? OCC::FileSystem::FolderPermissions::ReadOnly : OCC::FileSystem::FolderPermissions::ReadWrite; + if (_initialPermissions != temporaryPermissions) { + _rollbackNeeded = true; + FileSystem::setFolderPermissions(_path, temporaryPermissions); + } + } catch (const std::filesystem::filesystem_error &e) { + qCWarning(lcFileSystem()) << "exception when modifying folder permissions" << e.what() << e.path1().c_str() << e.path2().c_str(); } }