Skip to content

Configurable upload limit#642

Open
Pouf5 wants to merge 14 commits intoemdash-cms:mainfrom
Pouf5:configurable-upload-limit
Open

Configurable upload limit#642
Pouf5 wants to merge 14 commits intoemdash-cms:mainfrom
Pouf5:configurable-upload-limit

Conversation

@Pouf5
Copy link
Copy Markdown
Contributor

@Pouf5 Pouf5 commented Apr 18, 2026

What does this PR do?

Makes file upload size limit configurable via EmDashConfig. Previously, it was hardcoded as 50 MB.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation and pnpm locale:extract has been run (if applicable)
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: Configurable Upload Limit #641

AI-generated code disclosure

  • This PR includes AI-generated code

Screenshots / test output

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 18, 2026

🦋 Changeset detected

Latest commit: 2d060e9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 18, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@642

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@642

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@642

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@642

emdash

npm i https://pkg.pr.new/emdash@642

create-emdash

npm i https://pkg.pr.new/create-emdash@642

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@642

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@642

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@642

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@642

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@642

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@642

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@642

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@642

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@642

commit: 2d060e9

@github-actions github-actions bot added size/XL and removed size/L labels Apr 18, 2026
@ascorbic
Copy link
Copy Markdown
Collaborator

Thanks! Could oyu update the reference docs too.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a configurable media upload size limit (maxUploadSize) to EmDash so deployments can adjust the maximum allowed upload size (previously hardcoded to 50 MB), and wires the value through validation and OpenAPI generation.

Changes:

  • Introduces EmDashConfig.maxUploadSize (bytes) with a default of 50 MB.
  • Enforces the configured limit in both direct multipart uploads and signed-URL upload requests (validation layer).
  • Updates OpenAPI generation + caching path and adds unit/integration tests around the new behavior.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/core/src/astro/integration/runtime.ts Adds maxUploadSize to the public integration config type/docs.
packages/core/src/astro/integration/index.ts Serializes maxUploadSize into runtime config for use by routes/spec generation.
packages/core/src/api/schemas/media.ts Replaces hardcoded upload limit with DEFAULT_MAX_UPLOAD_SIZE + mediaUploadUrlBody(maxSize) factory.
packages/core/src/astro/routes/api/media.ts Applies maxUploadSize to multipart upload enforcement and messaging.
packages/core/src/astro/routes/api/media/upload-url.ts Applies maxUploadSize to signed-URL request body validation.
packages/core/src/api/openapi/document.ts Makes OpenAPI document generation depend on configured maxUploadSize.
packages/core/src/astro/routes/api/openapi.json.ts Passes runtime config into OpenAPI generation and handles invalid config failures.
packages/core/tests/unit/api/schemas.test.ts Adds unit coverage for the schema factory + boundary/error-message behavior.
packages/core/tests/integration/server.ts Adds per-server uploads dir + env passthrough support.
packages/core/tests/integration/fixture/astro.config.mjs Wires fixture storage + maxUploadSize via env for server-based tests.
packages/core/tests/integration/media/upload-limit.test.ts Adds a server-level test validating enforcement on both upload paths.
.changeset/better-rockets-listen.md Publishes the new config option as a patch change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/astro/routes/api/media/upload-url.ts
Comment thread packages/core/src/astro/routes/api/media.ts
Comment thread packages/core/src/api/schemas/media.ts
Comment thread packages/core/src/api/openapi/document.ts
Comment thread packages/core/tests/integration/media/upload-limit.test.ts Outdated
Comment thread packages/core/src/astro/integration/index.ts
@Pouf5
Copy link
Copy Markdown
Contributor Author

Pouf5 commented Apr 18, 2026

@ascorbic Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants