Repository navigation
@remotion/cli: Accept --props files saved with a UTF-8 BOM - #12645
Merged
Merged
Conversation
Windows PowerShell 5.1 (`Out-File -Encoding utf8`, `Set-Content -Encoding utf8`) and some editors write a UTF-8 BOM. JSON.parse() rejects it, so `--props=props.json` failed with "neither valid JSON nor a file path to a valid JSON file", and the Windows hint pointed users at the same file. Strip a leading BOM before parsing, both on the first read and when the watched file changes in the Studio. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Strip leading UTF-8 BOM before parsing
--propsfile —get-input-props.tsnow removes a leading\uFEFFfrom the file contents on both the initial read and the watched-file re-read, so PowerShell 5.1 / editor-authored JSON files parse correctly. - Regression test — new
src/test/get-input-props.test.tswrites a BOM-prefixed JSON file and assertsgetInputProps()returns the parsed object, matching the existingconfig-reload.test.tstemp-dir/spy conventions.
The fix is correct and matches the convention already used in captions/src/parse-srt.ts and parse-vtt.ts. I ran the new test locally (bun test src/test/get-input-props.test.ts) and it passes. The parallel bug in @remotion/lambda's get-webhook-custom-data.ts is already called out in the PR description as a follow-up.
deepseek-v4.1-flash | 𝕏
Member
|
Thank you! |
This branch was successfully 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.

On Windows,
--props=props.jsonfails when the file starts with a UTF-8 BOM. Windows PowerShell 5.1 writes one withOut-File -Encoding utf8/Set-Content -Encoding utf8, and some editors do too.JSON.parse()rejects the BOM, so the CLI prints "You passed --props but it was neither valid JSON nor a file path to a valid JSON file", and the Windows hint then suggests passing a JSON file path, which is the same file.This strips a leading BOM before parsing, both on the first read and when the Studio re-reads the watched file.
Before / after: calling the built
getInputProps()with that PowerShell-written file exits 1 with the error above on main, and returns{"title":"Hello"}with this change. The newsrc/test/get-input-props.test.tsfails on main and passes here;bun test srcinpackages/clipasses.@remotion/lambda's--webhook-custom-datareads files the same way; I can send that separately if you want it.I used Claude Code to write this change.