Skip to content

Commit

Permalink
fix(sqlite): remove leading / from file path
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Jan 8, 2025
1 parent 6f7b4df commit 85010c1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/runtime/internal/bunsqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const getBunSqliteDatabaseAdapter = (opts: { filename: string }) => {
const filename = !opts || isAbsolute(opts?.filename || '') || opts?.filename === ':memory:'
? opts?.filename
: new URL(opts.filename, (globalThis as unknown as { _importMeta_: { url: string } })._importMeta_.url).pathname
db = new Database(filename, { create: true })
db = new Database(process.platform === 'win32' && filename.startsWith('/') ? filename.slice(1) : filename, { create: true })
}

return {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/internal/sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const getBetter3DatabaseAdapter = (opts: { filename: string }) => {
const filename = !opts || isAbsolute(opts?.filename || '')
? opts?.filename
: new URL(opts.filename, (globalThis as unknown as { _importMeta_: { url: string } })._importMeta_.url).pathname
db = new Database(process.platform === 'win32' ? filename.slice(1) : filename)
db = new Database(process.platform === 'win32' && filename.startsWith('/') ? filename.slice(1) : filename)
}

return {
Expand Down

0 comments on commit 85010c1

Please sign in to comment.