Skip to content

Commit 73b2674

Browse files
committed
fix: enforce trailing slash redirect for admin root
1 parent d518549 commit 73b2674

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,14 @@ export const sqliteAdmin = ({ dbPath, prefix = "/admin", configPath = "./sqlite-
6969
return { session };
7070
})
7171
.onBeforeHandle(({ path, set, session, body }) => {
72+
// Enforce trailing slash for root to ensure relative assets work
73+
if (path === prefix) {
74+
set.redirect = prefix + '/';
75+
return;
76+
}
77+
7278
// Permitir assets e HTML principal
73-
if (path.includes('/assets/') || path === prefix || path === prefix + '/') return;
79+
if (path.includes('/assets/') || path === prefix + '/') return;
7480
if (path.endsWith('index.html')) return;
7581

7682
// Rotas Públicas de API

0 commit comments

Comments
 (0)