Repository navigation
Conversation
eeeurico
requested review from
danielgroves and
juice49
and removed request for
a team
October 27, 2026 00:51
|
@eeeurico is attempting to deploy a commit to the Sanity Sandbox Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 6767ab6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
A file upload created the mux.videoAsset document without a filename, so the Studio listed every new video under a slice of its Mux asset ID. Fill filename from the uploaded file with setIfMissing, so a name typed while the upload was processing still wins.
eeeurico
force-pushed
the
fix/mux-keep-upload-filename
branch
from
October 27, 2026 00:53
5f0faa6 to
6767ab6
Compare
This branch has not been deployed
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.
What happens today
When a video is uploaded as a file, the
mux.videoAssetdocument is written without afilename. The Studio then lists the video underassetId.slice(0, 12)(for exampleiKmsiHRjURhL) in the video browser, the details dialog and the input preview. The name the editor chose for the file is not stored anywhere: it is not on the Sanity document, and no title is sent to Mux either.URL uploads already pass a filename to the proxy, so this only affects file uploads. I checked 2.x and 3.x as well as 5.2.1, and none of them stored the file name, so this is long-standing rather than a regression.
On our dataset, 492 of 494 videos had no name after a couple of years of uploads, and the only way to find a video in the browser was by its ID.
The change
uploadFilepassesfile.nametoupdateAssetDocumentFromUpload.uploadedAssetTransactiontakes the optionalfilenameand addssetIfMissing({filename})to the patch it already makes.The change uses
setIfMissingrather thansetbecauseuploadedAssetTransactionpatches instead of replacing so that fields written while the upload is processing are kept. A name typed into the details dialog during that time still wins.Tests
I added a case to
upload.test.tsthat checks the serialized transaction carriessetIfMissing: {filename}. The existing case (no filename) is unchanged. I've checked the expected mutation shape against@sanity/clientdirectly, but I haven't run the monorepo's fullpnpm format/lint/knip/build/testlocally, so CI is the first full run.We've been running the same fix as a
pnpm patchon 5.0.10 in production: a new upload is listed asmux-filename-test.mp4instead of its ID.Not in this PR
meta.title. I tried adding it to the upload settings, but the asset came back withoutmeta, so the uploads proxy doesn't seem to forward it. That makes Sync all titles in the Videos tool setfilenametomuxTitle || ""for every asset, which blanks names that only exist in Sanity. It might be worth guarding that the way Fill missing titles only already is.mux.videofield.Note
Low Risk
Narrow upload-completion patch behavior using setIfMissing; no auth or API surface changes, and existing documents without filename are unchanged.
Overview
File uploads now persist the browser file’s name on the
mux.videoAssetdocument so Studio lists videos by that name instead of a truncated Mux asset ID.On successful upload,
uploadFilepassesfile.nameintoupdateAssetDocumentFromUpload, which forwards it touploadedAssetTransaction. That transaction still patches Mux fields withset, and when a name is provided it also appliessetIfMissing({ filename })so an editor-assigned title during upload is not overwritten. URL uploads were already setting filename via the proxy; this closes the gap for direct file picks.A unit test asserts the serialized Sanity transaction includes
setIfMissing: { filename: '…' }when a filename is passed.Reviewed by Cursor Bugbot for commit 6767ab6. Bugbot is set up for automated code reviews on this repo. Configure here.