Skip to content

Commit a9c53ba

Browse files
committed
fixup! sqlite: fix permission VFS edge cases
Assisted-by: Claude Code Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
1 parent 69d6cec commit a9c53ba

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/node_sqlite_vfs.cc‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,7 @@ bool FileControlRequiresWrite(int operation) {
316316

317317
int PermissionFileControl(sqlite3_file* file, int operation, void* argument) {
318318
PermissionFile* permission_file = PermissionFileFromBase(file);
319-
if (FileControlRequiresWrite(operation) &&
320-
!permission_file->can_write) {
319+
if (FileControlRequiresWrite(operation) && !permission_file->can_write) {
321320
return SQLITE_PERM;
322321
}
323322

‎test/parallel/test-permission-sqlite.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ const readWrite = `const { DatabaseSync } = require('node:sqlite');
195195
// a sidecar does not inherit permission when opened as a main database.
196196
const code = `const { DatabaseSync } = require('node:sqlite');
197197
const db = new DatabaseSync(process.env.DB_PATH);
198-
db.exec("ATTACH DATABASE '" + process.env.ATTACH_PATH + "' AS outside");`;
198+
const attachPath = process.env.ATTACH_PATH.replaceAll("'", "''");
199+
db.exec("ATTACH DATABASE '" + attachPath + "' AS outside");`;
199200
for (const attachPath of [deniedPath, suffixDbPath]) {
200201
const { status, stderr } = run(
201202
code,

0 commit comments

Comments
 (0)