Skip to content

fix(media): keep only MediaInput fields from MediaLit upload results - #931

Merged
s3rot0n1n merged 1 commit into
mainfrom
fix/medialit-upload-fields
Nov 26, 2026
Merged

s3rot0n1n merged 1 commit into
mainfrom
fix/medialit-upload-fields

Conversation

@s3rot0n1n

Copy link
Copy Markdown
Contributor

Problem

MediaLit v0.8.0 added processing and derivatives to media responses. CourseLit's upload hook (useMediaLit) passed MediaLit's whole response on, and GraphQL's MediaInput rejects fields it doesn't define. Every upload reached 100% and then failed with:

Variable "$logo" got invalid value … Field "processing" is not defined by type "MediaInput".

Fix

The hook keeps only the fields MediaInput defines (mediaId, originalFileName, mimeType, size, access, file, thumbnail, caption). This replaces the one-off removal of group. The filter lives in pick-media-fields.ts and has a regression test.

Upload areas checked

Every MediaSelector uploads through FileUploadAlertDialog, which uses the hook, so the one change covers them all.

Area Sent as Was broken
Site logo, lesson media, product and blog featured images, certificate signature and logo, profile avatar, community featured image, page social image MediaInput yes, now fixed
Community post attachments (direct hook use, 2 places) MediaInput inside CommunityPostInputMedia yes, now fixed
Hero, grid, media and section-background page blocks page layout String no
SCORM upload mediaId only no
Text editor images (/media/create) file, originalFileName, mediaId only no

WebP conversion now happens at seal instead of at upload, and CourseLit already handles that. Every save path seals the media on the server and stores the seal response; page layouts and text-editor documents replace the main.* and thumb.* URLs with the sealed ones.

Testing

  • The new pick-media-fields test passes, and so does the full web client suite: 38 suites, 184 tests.
  • Lint and prettier are clean on the changed files.
  • Not yet tested: a real upload against MediaLit v0.8.0. Before releasing, try a logo upload, a lesson video and a community post attachment on QA.

🤖 Generated with Claude Code

MediaLit v0.8.0 added `processing` and `derivatives` to media responses.
The upload hook passed the whole response on, and the GraphQL `MediaInput`
type rejects fields it doesn't define, so every upload failed after
reaching 100%: logo, featured images, lesson media, avatars, certificate
images, page social images and community post attachments.

The hook now keeps only the fields `MediaInput` defines, replacing the
one-off removal of `group`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T09:25:36.145578Z 1f3f644 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@s3rot0n1n
s3rot0n1n merged commit d4de95e into main Nov 26, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant