Skip to content

Fix video dimension extraction and Uploaded row truncation in media details - #3685

Merged
ascorbic merged 1 commit into
mainfrom
bot/fix-3682
Sep 30, 2026
Merged

ascorbic merged 1 commit into
mainfrom
bot/fix-3682

Conversation

@emdashbot

@emdashbot emdashbot Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Closes #3682.

  • Extracts display dimensions for supported video files (.mp4, .webm, .mov) client-side and sends them in both upload paths.
  • Keeps the Media Detail panel's Uploaded row in the wider column when dimensions are missing, preventing the date from being truncated.
  • Adds regression tests for video upload dimension propagation and the details-panel grid layout.

A patch changeset for @emdash-cms/admin is included.

Closes #3682.

A candidate change the reporter confirmed against their own site via the preview build:

npm i https://pkg.pr.new/emdash@bot/fix-3682

Opened automatically by emdashbot as a draft. A maintainer must review before merge.

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 (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main.
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...
  • I have included screenshots below if this PR changes the UI

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: emdashbot + Kimi K2.7 Code

Screenshots / test output

…etails

EmDash-Run: 5c4a0857-fb1b-43b5-a8ba-c9c4c90cdd02
@changeset-bot

changeset-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9a09b0f

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

This PR includes changesets to release 12 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/auth-atproto 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

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://bot-fix-3682.try.emdashcms.com, https://bot-fix-3682-emdash-playground.emdash-cms.workers.dev (commit 9a09b0f)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://90582f58.try.emdashcms.com, https://90582f58-emdash-playground.emdash-cms.workers.dev 9a09b0f 2026-09-30T09:47:29.940Z Visit the dashboard ↗

@ascorbic
ascorbic marked this pull request as ready for review September 30, 2026 11:14
@ascorbic
ascorbic enabled auto-merge (squash) September 30, 2026 11:15
@pkg-pr-new

pkg-pr-new Bot commented Sep 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

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

@emdash-cms/auth

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

@emdash-cms/auth-atproto

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

@emdash-cms/blocks

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

@emdash-cms/cloudflare

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

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

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

emdash

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

create-emdash

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

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

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

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@3685

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@3685

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@3685

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@3685

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@3685

@emdash-cms/registry-loader

npm i https://pkg.pr.new/@emdash-cms/registry-loader@3685

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@3685

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@3685

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@3685

@emdash-cms/x402

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

@emdash-cms/plugin-ai-moderation

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

@emdash-cms/plugin-atproto

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

@emdash-cms/plugin-audit-log

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

@emdash-cms/plugin-color

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

@emdash-cms/plugin-embeds

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

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@3685

@emdash-cms/plugin-forms

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

@emdash-cms/plugin-webhook-notifier

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

commit: 9a09b0f

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This PR correctly identifies that video uploads lack dimension reporting and that the details panel truncates the Uploaded date when no Dimensions row exists. Using a <video> element to read videoWidth/videoHeight client-side and sending the dimensions through both the direct-upload form and the signed-URL confirmation payload is consistent with how image dimensions already flow, and the server routes already accept and prefer client-provided dimensions.

I checked:

  • getVideoDimensions mirrors the existing getImageDimensions pattern (object URL, abort cleanup, resolve-null on error).
  • Server-side enrichImageMetadata skips non-image types, so the client-provided video dimensions are preserved in both POST /media and POST /media/:id/confirm.
  • No new user-facing strings (i18n workflow not needed) and no new public admin API surface (getVideoDimensions is not re-exported from lib/api/index.ts).
  • The changeset is clear and scoped to @emdash-cms/admin.

I found two issues to address before merge:

  1. The details-panel grid fix only pins gridColumnStart. When dimensions are absent, CSS Grid auto-placement puts Format in row 1 column 2 and drops Uploaded to row 2 column 1, so Format visually appears before Uploaded. The fix should also pin gridRowStart: 2 on Uploaded and Format so they stay on the same secondary row.
  2. The regression test for that layout only asserts gridColumnStart, so it passes regardless of the reordering. It should assert gridRowStart as well.

I also noted two comments that merely restate the next line; those can be removed while the code is being touched.


Findings

  • [needs fixing] packages/admin/src/components/MediaDetailPanel.tsx:1321-1351

    When dimensions are absent, the grid now pins Uploaded to column 1 but not to row 2. CSS Grid auto-placement will put Format in row 1 column 2 and drop Uploaded to row 2 column 1, so Format visually jumps above Uploaded.

    The stated fix is to keep Uploaded in the wider column; it should stay on the same row as Format.

    								{!isProviderAsset && (
    									<div
    										className="flex min-w-0 items-start gap-2 text-sm"
    										style={{ gridColumnStart: 1, gridRowStart: 2 }}
    									>
    
    								<div
    									className="flex min-w-0 items-start gap-2 text-sm"
    									style={{ gridColumnStart: 2, gridRowStart: 2 }}
    								>
    
  • [needs fixing] packages/admin/tests/components/MediaDetailPanel.test.tsx:319-330

    The regression test only checks gridColumnStart, so it cannot fail if Format moves into row 1 while Uploaded drops to row 2. A layout regression test should also assert the row placement.

    		await expect.element(screen.getByText("Uploaded:")).toBeInTheDocument();
    		expect(getComputedStyle(factByLabel("Size:")).gridColumnStart).toBe("1");
    		expect(getComputedStyle(factByLabel("Uploaded:")).gridColumnStart).toBe("1");
    		expect(getComputedStyle(factByLabel("Uploaded:")).gridRowStart).toBe("2");
    		expect(getComputedStyle(factByLabel("Format:")).gridColumnStart).toBe("2");
    		expect(getComputedStyle(factByLabel("Format:")).gridRowStart).toBe("2");
    
  • [suggestion] packages/admin/src/lib/api/media.ts:520-573

    These two comments only restate the following line. Since the code is being touched here, delete the comments instead of updating them.

    async function uploadMediaDirect(file: File, opts?: UploadMediaOptions): Promise<LocalMediaItem> {
    	const dimensions = await getMediaDimensions(file, opts);
    
    	await uploadToSignedUrl(file, uploadInfo, opts);
    
    	const dimensions = await getMediaDimensions(file, opts);
    

@ascorbic
ascorbic merged commit 1942b3a into main Sep 30, 2026
43 checks passed
@ascorbic
ascorbic deleted the bot/fix-3682 branch September 30, 2026 12:57
@emdashbot emdashbot Bot mentioned this pull request Sep 30, 2026
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.

Media Library: video (MP4) shows no dimensions, and the "Uploaded" row truncates with "..."

1 participant