Skip to content

[codex] Allow PNG custom background uploads#526

Open
Sunwood-ai-labs wants to merge 1 commit intosiddharthvaddem:mainfrom
Sunwood-ai-labs:codex/allow-png-background-upload
Open

[codex] Allow PNG custom background uploads#526
Sunwood-ai-labs wants to merge 1 commit intosiddharthvaddem:mainfrom
Sunwood-ai-labs:codex/allow-png-background-upload

Conversation

@Sunwood-ai-labs
Copy link
Copy Markdown

@Sunwood-ai-labs Sunwood-ai-labs commented May 3, 2026

Summary

  • Allow PNG files in the custom background upload validation and file picker accept list.
  • Add a small shared helper for MIME/extension validation so PNG still works when the browser does not provide a MIME type.
  • Update localized validation copy from JPG-only to JPG/JPEG/PNG.

Root cause

The custom background upload path only accepted image/jpeg / image/jpg and advertised .jpg,.jpeg,image/jpeg in the file picker. Valid PNG files were rejected before they reached the existing FileReader/data URL flow, even though the rest of the background image pipeline can handle image data URLs.

Validation

  • npx biome check src/components/video-editor/SettingsPanel.tsx src/components/video-editor/backgroundImageUpload.ts src/components/video-editor/backgroundImageUpload.test.ts src/i18n/locales/en/settings.json src/i18n/locales/es/settings.json src/i18n/locales/fr/settings.json src/i18n/locales/ja-JP/settings.json src/i18n/locales/ko-KR/settings.json src/i18n/locales/tr/settings.json src/i18n/locales/zh-CN/settings.json src/i18n/locales/zh-TW/settings.json
  • git diff --check
  • npx vitest run src/components/video-editor/backgroundImageUpload.test.ts src/lib/wallpaper.test.ts src/components/video-editor/projectPersistence.test.ts
  • npm run build-vite
  • Manual: validated a PNG custom background import locally with a 1672x941 PNG file.

Known baseline note

  • npm run i18n:check currently fails on main-existing extra keys unrelated to this change (tr/launch.json audio keys, several settings.json zoom/audio keys). This PR only updates the existing imageUpload.jpgOnly copy across locales.

Summary by CodeRabbit

  • New Features

    • Background image uploads now accept PNG in addition to JPG/JPEG; the upload selector and runtime validation reflect this.
  • Tests

    • Added test coverage for background image type validation, including MIME- and extension-based cases.
  • Chores

    • Updated user-facing upload guidance across multiple languages to mention JPG, JPEG, or PNG.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8df39eb3-162f-424b-b252-0f85f8a6d03d

📥 Commits

Reviewing files that changed from the base of the PR and between bc17fd1 and 613ed00.

📒 Files selected for processing (11)
  • src/components/video-editor/SettingsPanel.tsx
  • src/components/video-editor/backgroundImageUpload.test.ts
  • src/components/video-editor/backgroundImageUpload.ts
  • src/i18n/locales/en/settings.json
  • src/i18n/locales/es/settings.json
  • src/i18n/locales/fr/settings.json
  • src/i18n/locales/ja-JP/settings.json
  • src/i18n/locales/ko-KR/settings.json
  • src/i18n/locales/tr/settings.json
  • src/i18n/locales/zh-CN/settings.json
  • src/i18n/locales/zh-TW/settings.json
✅ Files skipped from review due to trivial changes (10)
  • src/i18n/locales/ja-JP/settings.json
  • src/i18n/locales/en/settings.json
  • src/i18n/locales/zh-TW/settings.json
  • src/components/video-editor/backgroundImageUpload.ts
  • src/i18n/locales/zh-CN/settings.json
  • src/i18n/locales/ko-KR/settings.json
  • src/i18n/locales/fr/settings.json
  • src/i18n/locales/es/settings.json
  • src/i18n/locales/tr/settings.json
  • src/components/video-editor/SettingsPanel.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/video-editor/backgroundImageUpload.test.ts

📝 Walkthrough

Walkthrough

SettingsPanel now accepts PNG in addition to JPG/JPEG by switching its file-input accept and runtime validation to shared constants/helpers (BACKGROUND_IMAGE_ACCEPT, isSupportedBackgroundImageType). A new validation module and unit tests were added, and the upload-help text was updated across eight locales. (≈50 words)

Changes

Background Image Type Support

Layer / File(s) Summary
Constants & Validation
src/components/video-editor/backgroundImageUpload.ts
Adds BACKGROUND_IMAGE_ACCEPT (".jpg,.jpeg,.png,image/jpeg,image/png") and isSupportedBackgroundImageType(type, fileName) implementing MIME-first validation with extension fallback when MIME is empty.
Component Integration
src/components/video-editor/SettingsPanel.tsx
Imports BACKGROUND_IMAGE_ACCEPT and isSupportedBackgroundImageType; replaces hardcoded accept value and the previous explicit image/jpeg/image/jpg type checks with the new helpers in the upload handler.
Validation Tests
src/components/video-editor/backgroundImageUpload.test.ts
Adds Vitest suite with cases: accept PNG via MIME, accept PNG via extension when MIME empty, reject non-image .txt, and reject when MIME explicitly unsupported despite a supported extension.
User-Facing Text
src/i18n/locales/*/settings.json
src/i18n/locales/en/..., es, fr, ja-JP, ko-KR, tr, zh-CN, zh-TW
Updates imageUpload.jpgOnly string in eight locale files to include PNG alongside JPG/JPEG.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • siddharthvaddem

Poem

a tiny png slipped into line,
joins jpeg’s midnight design.
helpers, tests, and texts align—kinda smooth, lowkey fine,
locales whisper in eight tongues: now three formats shine 📸✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: enabling PNG support for custom background uploads, which is the primary purpose of this PR.
Description check ✅ Passed The PR description covers the key sections but is structured as a custom format rather than following the provided template, though it includes sufficient detail on changes, root cause, validation, and known issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@Sunwood-ai-labs Sunwood-ai-labs marked this pull request as ready for review May 3, 2026 06:00
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc17fd1dab

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +12 to +14
const lowerName = fileName.trim().toLowerCase();
return [...SUPPORTED_BACKGROUND_IMAGE_EXTENSIONS].some((extension) =>
lowerName.endsWith(extension),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict extension fallback to empty MIME types

The new validator accepts files by extension even when the browser reports an explicit unsupported MIME type. For example, a text/plain file named notes.png now returns true, whereas this upload path previously rejected non-image MIME types. This can pass non-image payloads into the wallpaper flow and produce broken uploads; the extension check should only run when type is empty/unknown.

Useful? React with 👍 / 👎.

@Sunwood-ai-labs Sunwood-ai-labs force-pushed the codex/allow-png-background-upload branch from bc17fd1 to 613ed00 Compare May 3, 2026 06:19
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