Skip to content

Commit a001a75

Browse files
authored
fix: resolve Astro DB seed failure with paths containing spaces (#13343)
1 parent 55ef4f5 commit a001a75

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changeset/hip-horses-count.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@astrojs/db": patch
3+
---
4+
5+
Fix Astro DB seed failing when project path contains spaces. This resolves by properly decoding URL pathnames that contain encoded spaces (%20) before passing them to Vite's ssrLoadModule.

packages/db/src/core/integration/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ async function executeSeedFile({
197197
fileUrl: URL;
198198
viteServer: ViteDevServer;
199199
}) {
200-
const mod = await viteServer.ssrLoadModule(fileUrl.pathname);
200+
// Use decodeURIComponent to handle paths with spaces correctly
201+
// This ensures that %20 in the pathname is properly handled
202+
const pathname = decodeURIComponent(fileUrl.pathname);
203+
const mod = await viteServer.ssrLoadModule(pathname);
201204
if (typeof mod.default !== 'function') {
202205
throw new AstroDbError(EXEC_DEFAULT_EXPORT_ERROR(fileURLToPath(fileUrl)));
203206
}

0 commit comments

Comments
 (0)