From d4513c64917c650e52f70291d276a25b5f14018c Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Mon, 6 Jan 2025 22:06:29 +0100 Subject: [PATCH] ensure proper read write access to root folder and db files Signed-off-by: Matthieu Gallien --- src/gui/folder.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index fffbb11e5eaec..bcb3ed70f7547 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -543,7 +543,15 @@ void Folder::startVfs() // Immediately mark the sqlite temporaries as excluded. They get recreated // on db-open and need to get marked again every time. - QString stateDbFile = _journal.databaseFilePath(); + const auto stateDbFile = _journal.databaseFilePath(); + const auto stateDbWalFile = QString(stateDbFile + QStringLiteral("-wal")); + const auto stateDbShmFile = QString(stateDbFile + QStringLiteral("-shm")); + + FileSystem::setFileReadOnly(stateDbFile, false); + FileSystem::setFileReadOnly(stateDbWalFile, false); + FileSystem::setFileReadOnly(stateDbShmFile, false); + FileSystem::setFolderPermissions(path(), FileSystem::FolderPermissions::ReadWrite); + _journal.open(); _vfs->fileStatusChanged(stateDbFile + "-wal", SyncFileStatus::StatusExcluded); _vfs->fileStatusChanged(stateDbFile + "-shm", SyncFileStatus::StatusExcluded);