Skip to content

fix: add TextOverlay type and validate textOverlays in isValidRecipe - #1280

Open
sudha09-git wants to merge 3 commits into
magic-peach:mainfrom
sudha09-git:fix/isValidRecipe-textOverlays-validation
Open

fix: add TextOverlay type and validate textOverlays in isValidRecipe#1280
sudha09-git wants to merge 3 commits into
magic-peach:mainfrom
sudha09-git:fix/isValidRecipe-textOverlays-validation

Conversation

@sudha09-git

Copy link
Copy Markdown
Contributor

Summary

Closes #1246

Problem

isValidRecipe in src/lib/types.ts had no textOverlays field at all.
Malformed overlays from shared URLs could reach buildTextFilter and cause
opaque FFmpeg failures with no useful error message.

Changes

src/lib/types.ts

  • Added TextOverlay interface (id, text, x, y, fontSize, color, fontWeight)
  • Added textOverlays: TextOverlay[] field to EditRecipe
  • Added textOverlays: [] to DEFAULT_RECIPE
  • Added isValidTextOverlay helper with full per-element validation:
    • x, y: finite number in range 0–100
    • fontSize: finite number in range 8–300
    • color: valid CSS hex regex /^#[0-9a-fA-F]{3,8}$/
    • fontWeight: enum of "normal", "bold", "900"
  • isValidRecipe now returns false for any invalid overlay element

src/lib/constants.ts

  • Added textOverlays: [] to DEFAULT_RECIPE

src/lib/ffmpeg.ts

  • Added buildTextFilter to generate safe FFmpeg drawtext filters
  • Text and color values are escaped before being passed to FFmpeg
  • Wired buildTextFilter into buildArguments filter chain

Testing

  • npx tsc --noEmit passes with zero errors

@vercel

vercel Bot commented May 27, 2026

Copy link
Copy Markdown

@sudha09-git is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @sudha09-git!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@github-actions github-actions Bot added level:advanced Advanced level - 55 pts type:bug Bug fix type:design UI/UX design type:testing Testing labels May 27, 2026
@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

✅ PR Format Check Passed — @sudha09-git

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@sudha09-git
sudha09-git force-pushed the fix/isValidRecipe-textOverlays-validation branch 2 times, most recently from 08750be to f2d3527 Compare May 27, 2026 09:56
@github-actions github-actions Bot added the level:intermediate Intermediate level - 35 pts label May 27, 2026
@sudha09-git
sudha09-git force-pushed the fix/isValidRecipe-textOverlays-validation branch 3 times, most recently from 201595f to 04b336c Compare May 27, 2026 10:11
- Add TextOverlay interface with id, text, x, y, fontSize, color, fontWeight
- Add textOverlays field to EditRecipe and DEFAULT_RECIPE (types.ts + constants.ts)
- Add isValidTextOverlay helper with full per-element validation
- Add buildTextFilter to generate FFmpeg drawtext filters
- Wire buildTextFilter into buildArguments filter chain

Closes magic-peach#1246
@sudha09-git
sudha09-git force-pushed the fix/isValidRecipe-textOverlays-validation branch from 5468b68 to 407d172 Compare May 27, 2026 10:17
@sudha09-git

Copy link
Copy Markdown
Contributor Author

Hi @magic-peach
All code quality checks are passing. The only failing check is Vercel — "Authorization required to deploy" — which I believe needs your approval as a maintainer. Could you please authorize it and review when you get a chance? Happy to make any changes!


@sudha09-git

Copy link
Copy Markdown
Contributor Author

/approve

@sudha09-git

sudha09-git commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

kindly approve my PR
I'm Gssoc 2026 contributor

@magic-peach

Copy link
Copy Markdown
Owner

Hi @sudha09-git — good news and a small ask.

Your PR passed review in our backlog cleanup and was queued to merge. We merged 38 PRs today, and yours now conflicts with main purely because of that — several of them touched the same files. Nothing is wrong with your change.

To land it:

git fetch origin
git rebase origin/main
# resolve conflicts
git push --force-with-lease

Ping me here once it's green and I'll merge it straight away — it's already approved on our side, so it won't go back into the queue. Thanks for your patience with how long this sat 🙏

@magic-peach magic-peach added the merge-ready PR is approved and ready to merge label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:advanced Advanced level - 55 pts level:intermediate Intermediate level - 35 pts merge-ready PR is approved and ready to merge type:bug Bug fix type:design UI/UX design type:testing Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [GSSoC'26] isValidRecipe skips per-element validation of textOverlays -- malformed overlays in shared URLs cause opaque FFmpeg filter errors

2 participants