fix: add filename search and type filtering to the media library#1227
Draft
scottbuscemi wants to merge 1 commit into
Draft
fix: add filename search and type filtering to the media library#1227scottbuscemi wants to merge 1 commit into
scottbuscemi wants to merge 1 commit into
Conversation
The Media Library page and the content-editor media picker had no way to search or filter local media, making large libraries hard to use. Add a `q` filename substring filter (case-insensitive, matches extensions, LIKE wildcards escaped) to the media list endpoint alongside the existing mimeType filter, and wire both surfaces: the Media page gets a search box plus a type filter (images/video/audio/documents) and the picker searches the local library by filename. Closes #1221.
🦋 Changeset detectedLatest commit: 6982051 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
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 |
Contributor
PR template validation failedPlease fix the following issues by editing your PR description:
See CONTRIBUTING.md for the full contribution policy. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | 6982051 | May 29 2026, 11:11 PM |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/blocks
@emdash-cms/cloudflare
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-demo-cache | 6982051 | May 29 2026, 11:12 PM |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
emdash-playground | 6982051 | May 29 2026, 11:12 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1221.
Problem
Media items couldn't be searched or filtered — on the Media Library page (
/_emdash/admin/media) or in the content-editor media picker. With large libraries this made finding an asset impractical. The issue asked for search by file type, extension, and filename.Fix
Backend (
emdash)mediaListQuerygains an optionalq(trimmed, 1–200 chars).MediaRepository.findManyapplies a case-insensitivelower(filename) LIKE %q%filter (SQLite/Postgres parity), with LIKE wildcards (% _ \) in the term escaped viaESCAPE '\'. A filename substring covers both filename and extension (e.g..png). The existingmimeTypefilter already covers file type.handleMediaList, the runtime, and theGET /_emdash/api/mediaroute.Admin (
@emdash-cms/admin)fetchMediaListsendsq.mimeType).MediaLibraryreports both upward; the route feeds them into the infinite query key + fetch.MediaPickerModal): its existing search box now also shows for the local library and drives a debouncedqagainstfetchMediaList.Testing
packages/core/tests/integration/database/media-filename-search.test.ts(describeEachDialect): substring + case-insensitive, extension match, combined withmimeType, and wildcard-escape ("100%"matches only the literal). Passing on SQLite locally; Postgres in CI.MediaLibrarytests: reports the debounced query upward; reports a MIME filter when a type is chosen.pnpm lint:jsonclean;emdash+@emdash-cms/admintypecheck pass. Admin browser tests run in CI (no local browser available here).Manual verification
.png); list filters. Change the type filter; list narrows by kind.Try this PR
Open a fresh playground →
A full working EmDash site, deployed from this branch. Each visit gets its own session-scoped sandbox: no login needed and no shared state. Try the admin, edit content, hit the public site.
Tracks
fix/1221-media-search. Updated automatically when the playground redeploys.