Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to enclosure selection logic #283

Merged
merged 6 commits into from
Nov 22, 2024
Merged

Conversation

vslavik
Copy link
Owner

@vslavik vslavik commented Nov 19, 2024

See #276 and #281 for a discussion of the issues.

This PR tackles the bugs by rewriting all the related code in a more readable and easier-to-follow way.

Move various helper functions above the Expat XML parsing handlers,
instead of having them interleaved.

No actual changes.
Refactoring to enable working with multiple enclosures.
Instead of aways manipulating the last element of std::vector<Appcast>
(with necessary checks), simply keep the current work-in-progress item
as a variable and push it to the vector after parsing is done.
Rework the sparkle:os matching code to be more readable and, above all,
correct even in presence of multiple enclosures.

To do this, this commit does the following:

- Parse all enclosures into a vector, then filter out unsuitable
  enclosures
- From the remaining ones, pick the most specific (e.g. "windows-x64" is
  used over "windows" or os-less, if both are present)
- Skip over appcast items that have only unsuitable enclosures
- Renames helper functions to have more clear names.

Fixes #276, fixes #281.
Check if an item is valid, i.e. has either a usable enclosure or a link
to open in the browser.
@vslavik vslavik merged commit f66e205 into master Nov 22, 2024
12 checks passed
@vslavik vslavik deleted the devel/enclosure-selection-fixes branch November 22, 2024 09:25
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