Skip to content

Fix handling of formulae and casks with null homepage values#19

Merged
cosmincatalin merged 2 commits intomainfrom
copilot/fix-null-homepage-issue
Oct 21, 2025
Merged

Fix handling of formulae and casks with null homepage values#19
cosmincatalin merged 2 commits intomainfrom
copilot/fix-null-homepage-issue

Conversation

Copy link
Contributor

Copilot AI commented Oct 20, 2025

Problem

Brew-explorer was crashing when encountering formulae or casks with null homepage values in the Homebrew JSON response. This caused a deserialization error:

Error loading packages from Homebrew: invalid type: null, expected a string at line 4037 column 22

Example of a formulae with null homepage: deterministic-zip

error-screenshot

Solution

Updated the data structures and conversion logic to properly handle null homepage values:

  1. Changed homepage field type: Modified BrewFormula and BrewCask structs to use Option<String> instead of String for the homepage field, allowing null values from JSON
  2. Added fallback value: When a null homepage is encountered, the application now displays "No homepage available" instead of crashing
  3. Updated all conversion paths: Ensured both the From trait implementations and the refresh_package method handle null homepages correctly

Testing

Added comprehensive tests to verify the fix:

  • Deserialization tests for null homepage in both formulae and casks
  • Conversion tests ensuring PackageInfo correctly uses the fallback value
  • All existing tests continue to pass

The application now gracefully handles packages without homepage information whilst maintaining full functionality for packages that do provide this field.

Original prompt

This section details on the original issue you should resolve

<issue_title>Formulae with null as homepage not handled.</issue_title>
<issue_description>If a formulae has a homepage that is null, then brew explorer fails to load:

Image

Example of formulae with null as homepage: https://github.com/timo-reymann/deterministic-zip </issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #18


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI self-assigned this Oct 20, 2025
Co-authored-by: cosmincatalin <525590+cosmincatalin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix brew explorer failing to load due to null homepage Fix handling of formulae and casks with null homepage values Oct 20, 2025
Copilot AI requested a review from cosmincatalin October 20, 2025 18:41
@cosmincatalin cosmincatalin marked this pull request as ready for review October 21, 2025 07:12
@cosmincatalin cosmincatalin merged commit a43ea76 into main Oct 21, 2025
3 checks passed
@cosmincatalin cosmincatalin deleted the copilot/fix-null-homepage-issue branch October 21, 2025 07:12
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.

Formulae with null as homepage not handled.

2 participants