From a0c77fc7164662ea62b65c51fd1bd4c2f6028bc1 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Wed, 1 May 2024 14:03:55 +0200 Subject: [PATCH] chore: changeset (#10925) --- .changeset/olive-cars-run.md | 5 +++++ packages/db/src/runtime/index.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/olive-cars-run.md diff --git a/.changeset/olive-cars-run.md b/.changeset/olive-cars-run.md new file mode 100644 index 0000000000..603ba0f7c1 --- /dev/null +++ b/.changeset/olive-cars-run.md @@ -0,0 +1,5 @@ +--- +"@astrojs/db": patch +--- + +Fixes `ASTRO_DATABASE_FILE` not correctly resolving relative paths (e.g. `ASTRO_DATABASE_FILE=./api/database.db` diff --git a/packages/db/src/runtime/index.ts b/packages/db/src/runtime/index.ts index 06d08a8793..11a6758034 100644 --- a/packages/db/src/runtime/index.ts +++ b/packages/db/src/runtime/index.ts @@ -139,7 +139,8 @@ export function normalizeDatabaseUrl(envDbUrl: string | undefined, defaultDbUrl: if (envDbUrl.startsWith('file://')) { return envDbUrl; } - return new URL(envDbUrl, pathToFileURL(process.cwd())).toString(); + + return new URL(envDbUrl, pathToFileURL(process.cwd()) + "/").toString(); } else { // This is going to be a file URL always, return defaultDbUrl;