Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-content-authors-wiring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"emdash": patch
---

Fixes the admin author filter returning HTTP 500 (`NOT_CONFIGURED` / "EmDash is not initialized") for every collection. The `handleContentAuthors` handler was never exposed on the per-request `locals.emdash` object in middleware, so `GET /_emdash/api/content/{collection}/authors` always tripped its not-initialized guard while sibling content routes worked normally.
1 change: 1 addition & 0 deletions packages/core/src/astro/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ export const onRequest = defineMiddleware(async (context, next) => {
// Content handlers
handleContentList: runtime.handleContentList.bind(runtime),
handleContentGet: runtime.handleContentGet.bind(runtime),
handleContentAuthors: runtime.handleContentAuthors.bind(runtime),
handleContentCreate: runtime.handleContentCreate.bind(runtime),
handleContentUpdate: runtime.handleContentUpdate.bind(runtime),
handleContentDelete: runtime.handleContentDelete.bind(runtime),
Expand Down
5 changes: 5 additions & 0 deletions packages/core/tests/unit/astro/middleware-prerender.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const {
configuredPlugins: [],
handleContentList: ok,
handleContentGet: ok,
handleContentAuthors: ok,
handleContentCreate: ok,
handleContentUpdate: ok,
handleContentDelete: ok,
Expand Down Expand Up @@ -232,6 +233,10 @@ describe("astro middleware prerendered routes", () => {
const emdash = locals.emdash as Record<string, unknown>;
expect(typeof emdash.handlePluginApiRoute).toBe("function");
expect(typeof emdash.handlePublicPluginApiRoute).toBe("function");
// Regression for #1462: the author filter route reads
// `locals.emdash.handleContentAuthors`; it must be wired onto the
// runtime helpers object or every `/authors` request 500s.
expect(typeof emdash.handleContentAuthors).toBe("function");
});

it("does not access context.session when prerendering public pages", async () => {
Expand Down
Loading