Skip to content

[Bug]: Invalid saved theme profile names are shown after loading from disk #338

Description

@Shreya-nipunge

Description

Saved theme profiles loaded from themeProfiles.json are returned without validating profile names or sanitizing profile contents. getThemeProfiles() returns settingsStore.loadProfiles() directly, while load/delete/duplicate/export paths validate names later, creating inconsistent behavior.

If the file contains legacy, corrupt, or manually edited invalid profile keys, Settings can display profiles that later cannot be loaded, deleted, duplicated, or exported consistently.

Steps to Reproduce

  1. Add an invalid key such as bad/profile:name to themeProfiles.json.
  2. Restart Paraline and open Settings.
  3. Check the theme profile dropdown and try loading, deleting, duplicating, or exporting that profile.

Expected Behaviour

Only profiles with valid names should be exposed to the UI. Invalid entries should be filtered out or migrated during load so all profile actions behave consistently.

Actual Behaviour

loadProfiles() returns the raw parsed object. Invalid profile names can appear in the Settings dropdown even though main-process profile actions reject them later.

Evidence

  • settingsStore.loadProfiles() only checks that parsed JSON is a non-array object, then returns it directly.
  • getThemeProfiles() returns settingsStore.loadProfiles() directly.
  • Settings renders every returned profile key into the dropdown.
  • Later profile actions validate names with isValidProfileName() before acting.

Environment

  • OS: Windows
  • Browser / Node version: Node v22.17.0, Electron ^37.0.0
  • Repo version / commit: v2.2.0 / dbaae83

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions