Skip to content

Draft articles are reachable in production #10

Description

@tokiory

Problem

Draft article files under content/articles/drafts/ can still be resolved by the production article route.

src/routes/(standard)/articles/[...slug]/+page.ts only uses the development guard for the special draft import path. In production, a request like /articles/drafts/svelte falls through to:

post = await import(`$content/articles/${params.slug}.mdx`);

That can resolve content/articles/drafts/svelte.mdx.

Impact

Unpublished draft content can be served publicly in production. The production build also emits draft chunks, confirming inclusion.

Expected

Draft article slugs should 404 in production and draft content should not be included in production output unless explicitly intended.

Suggested Fix

Reject any params.slug containing drafts/ outside development before attempting the generic content import, or exclude drafts from production bundling entirely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions