Skip to content

fix: validate custom color presets from localStorage#342

Merged
SamXop123 merged 2 commits into
SamXop123:mainfrom
mayurigade-hub:fix/validate-custom-color-presets
Jul 7, 2026
Merged

fix: validate custom color presets from localStorage#342
SamXop123 merged 2 commits into
SamXop123:mainfrom
mayurigade-hub:fix/validate-custom-color-presets

Conversation

@mayurigade-hub

Copy link
Copy Markdown
Contributor

Related Issue

Closes #322


Description

Fixed an issue where custom color presets loaded from localStorage were only validated for array length and not for the validity of their color values.

Previously, malformed or corrupted preset data containing invalid color strings could be accepted by the application, potentially causing incorrect colors to appear or failures in the color picker.

This fix validates each preset color using a hex color pattern before adding the preset to the available presets. Invalid presets are ignored to ensure only valid hex color values are used.


Changes Made

  • Added hex color validation for all custom preset values.
  • Accepted only colors matching the #RRGGBB format.
  • Ignored invalid or corrupted preset entries from localStorage.
  • Improved reliability of the color preset loading process.

Steps to Test

  1. Open the Settings page.
  2. Open the browser DevTools console.
  3. Run:
    localStorage.setItem("paraline_presets", JSON.stringify({
      BrokenPreset: ["red", "bad-value", "#123"]
    }));
  4. Reload the page.
  5. Verify that BrokenPreset is not loaded or is ignored.
  6. Add a preset containing three valid hex colors.
  7. Reload the page and verify the valid preset loads correctly.

Expected Result

  • Only presets containing valid #RRGGBB hex color values are loaded.
  • Invalid or corrupted presets are rejected.
  • The color picker receives only valid color values.
  • Existing valid presets continue to work as expected.

Files Changed

  • settings.js

Type of Change

☑️ Bug fix

☐ New feature

☐ Breaking change

☐ Documentation update

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

@mayurigade-hub is attempting to deploy a commit to the Dot_NotSam's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4320058e-cd89-43be-ba61-f611899abc97

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

@mayurigade-hub

Copy link
Copy Markdown
Contributor Author

Hello @SamXop123
Please review this PR.
Thank you!

@SamXop123 SamXop123 merged commit 45357de into SamXop123:main Jul 7, 2026
3 of 5 checks passed
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🎉 Congratulations @mayurigade-hub! 🎉

Your pull request has been successfully merged into Paraline! Thank you so much for your valuable contribution and effort. Every single improvement helps make Paraline a better desktop experience for everyone! 🙌

🚀 What's Next?

  • Keep the momentum going! Feel free to browse through our open Issues and grab another one that interests you!
  • Support the Project: If you enjoyed contributing to Paraline, please take a second to star our repository! It helps increase the project's visibility and supports our community. ⭐

💬 Stay Connected:
Have any questions, want feedback, or just want to discuss further contributions? Feel free to reach out directly to the maintainer on Discord: dot_notsam!

Thank you again, and keep up the amazing work! 💻✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Custom Color Presets From LocalStorage Are Not Validated As Hex Colors

2 participants