ensure proper read write access to root folder and db files
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Mon, 6 Jan 2025 21:06:29 +0000 (22:06 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Tue, 7 Jan 2025 07:45:50 +0000 (07:45 +0000)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/gui/folder.cpp

index 6b7f2ad45fc34f74e12c36bccc0df426ac3a76d9..5c7cf46f834b675edd7c465bb2ce2937fdf1bee4 100644 (file)
@@ -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);