Skip to content

Commit

Permalink
Consider Sparkle versions at item level, not just enclosure level
Browse files Browse the repository at this point in the history
Resolves #206
  • Loading branch information
homebysix committed Jan 5, 2025
1 parent 90da8f9 commit 9699d9d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ All notable changes to this project will be documented in this file. This projec

## Unreleased

Nothing yet.
### Fixed

- Resolved an issue with Sparkle feed parsing that could cause Recipe Robot to insert a static download URL in URLDownloader if the feed provided a version at the item level instead of the enclosure level (#206).

## [2.3.1] - 2023-10-19

Expand Down
27 changes: 15 additions & 12 deletions scripts/recipe_robot_lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2158,18 +2158,21 @@ def inspect_sparkle_feed_url(input_path, args, facts):
sparkle_ns = "{http://www.andymatuschak.org/xml-namespaces/sparkle}"
sparkle_provides_version = False
sparkle_info = []
for item in doc.iterfind("channel/item/enclosure"):
encl_vers = item.get(sparkle_ns + "version")
encl_shortvers = item.get(sparkle_ns + "shortVersionString")
if encl_vers or encl_shortvers:
sparkle_provides_version = True
sparkle_info.append(
{
"url": item.attrib.get("url", ""),
"version": encl_vers,
"shortVersionString": encl_shortvers,
}
)
for item in doc.iterfind("channel/item"):
item_vers = item.find(sparkle_ns + "version").text
item_shortvers = item.find(sparkle_ns + "shortVersionString").text
for encl in item.iterfind("enclosure"):
encl_vers = encl.get(sparkle_ns + "version")
encl_shortvers = encl.get(sparkle_ns + "shortVersionString")
if any([item_vers, item_shortvers, encl_vers, encl_shortvers]):
sparkle_provides_version = True
sparkle_info.append(
{
"url": encl.attrib.get("url", ""),
"version": encl_vers or item_vers,
"shortVersionString": encl_shortvers or item_shortvers,
}
)

# Remove items with unusable URLs.
sparkle_nones = (None, "", "null", "n/a", "none")
Expand Down

0 comments on commit 9699d9d

Please sign in to comment.