Skip to content

app Fix silent failure when domain.json has invalid icon#1507

Open
DSingh0304 wants to merge 1 commit intozulip:mainfrom
DSingh0304:fix-icon-url-crash
Open

app Fix silent failure when domain.json has invalid icon#1507
DSingh0304 wants to merge 1 commit intozulip:mainfrom
DSingh0304:fix-icon-url-crash

Conversation

@DSingh0304
Copy link
Copy Markdown
Collaborator

Fixes: #1278

Description

This PR addresses a bug where a missing or malformed icon field in the domain.json configuration file prevented the application from starting successfully.

Root Cause: The Zod configuration schema required icon to be a non-empty string. If this field was missing (common after manual configuration edits), the entire server list failed to parse in the renderer, causing the app to "hang" on a loading state without showing any configured servers.

Technical Changes

  1. Schema Robustness: Updated the serverConfigSchema in app/renderer/js/utils/domain-util.ts to make the icon field optional with a fallback to defaultIconSentinel.
  2. Graceful Degradation: This ensures that servers with invalid or missing icons load properly using the bundled Zulip logo, rather than crashing the renderer.

Screenshots and screen captures:
image

Platforms this PR was tested on:

  • Windows
  • macOS
  • Linux (Ubuntu 24.04)
Self-review checklist
  • Self-reviewed the changes for clarity and maintainability.
  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.
  • Visual appearance of the changes verified.
  • End-to-end functionality of buttons, interactions and flows verified.
  • Corner cases (missing/null/invalid icon) handled via schema defaults.

The Zod schema for server config entries required `icon` to be a
non-empty string. If the field was missing or empty, schema parsing
would throw, causing getDomains() to silently return an empty array.
This left the user with the "Add Organization" screen and no way to
connect to their configured servers.

Give the `icon` field a safe default of `defaultIconSentinel` so
that entries with missing icons still load correctly and fall back
to the bundled default icon.

Fixes zulip#1278.
@DSingh0304
Copy link
Copy Markdown
Collaborator Author

Ready for review!

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.

icon url in config should not prevent zulip from starting

1 participant