Fix appcast child elements being ignored when the Sparkle namespace uses a custom prefix (#2923)

The children of <sparkle:informationalUpdate> and <sparkle:tags> were matched
against their qualified name instead of being resolved through the Sparkle
namespace URI, unlike every other element in the parser.
This commit is contained in:
Leo Camus authored and GitHub committed 2026-09-15 20:26:26 -07:00
1 parent efc9a22635
commit 07db2480ad
3 files changed
+27 -4

No files matched your search

+4 -3
View File
@@ -177,7 +177,7 @@
NSMutableArray *names = [NSMutableArray array];
NSEnumerator *childEnum = [[node children] objectEnumerator];
for (NSXMLNode *child in childEnum) {
NSString *childName = child.name;
NSString *childName = [self sparkleNamespacedNameOfNode:child];
if (childName) {
[names addObject:childName];
}
@@ -187,12 +187,13 @@
NSMutableSet *informationalUpdateVersions = [NSMutableSet set];
NSEnumerator *childEnum = [[node children] objectEnumerator];
for (NSXMLNode *child in childEnum) {
if ([child.name isEqualToString:SUAppcastElementVersion]) {
NSString *childName = [self sparkleNamespacedNameOfNode:child];
if ([childName isEqualToString:SUAppcastElementVersion]) {
NSString *version = child.stringValue;
if (version != nil) {
[informationalUpdateVersions addObject:version];
}
} else if ([child.name isEqualToString:SUAppcastElementBelowVersion]) {
} else if ([childName isEqualToString:SUAppcastElementBelowVersion]) {
NSString *version = child.stringValue;
if (version != nil) {
// Denote version is used as an upper bound by using '<'
+17
View File
@@ -14,5 +14,22 @@
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" customNS:version="2.0" length="1346234" />
</item>
<item>
<title>Version 4.0</title>
<pubDate>Sat, 26 Jul 2014 15:20:13 +0000</pubDate>
<customNS:informationalUpdate>
<customNS:version>2.5</customNS:version>
</customNS:informationalUpdate>
<link>https://sparkle-project.org</link>
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" customNS:version="4.0" length="1346234" />
</item>
<item>
<title>Version 5.0</title>
<pubDate>Sat, 26 Jul 2014 15:20:14 +0000</pubDate>
<customNS:tags>
<customNS:criticalUpdate/>
</customNS:tags>
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" customNS:version="5.0" length="1346234" />
</item>
</channel>
</rss>
+6 -1
View File
@@ -1009,12 +1009,17 @@ class SUAppcastTest: XCTestCase {
let appcast = try SUAppcast(xmlData: testData as Data, relativeTo: nil, stateResolver: stateResolver, signingValidationStatus: .skipped)
let items = appcast.items
XCTAssertEqual(2, items.count)
XCTAssertEqual(4, items.count)
XCTAssertEqual("Version 2.0", items[1].title)
XCTAssertEqual("desc", items[1].itemDescription)
XCTAssertNotNil(items[0].releaseNotesURL)
XCTAssertEqual("https://sparkle-project.org/#works", items[0].releaseNotesURL!.absoluteString)
// Child elements of <sparkle:informationalUpdate> and <sparkle:tags> must be
// resolved through the namespace URI too, not through their qualified name
XCTAssertFalse(items[2].isInformationOnlyUpdate)
XCTAssertTrue(items[3].isCriticalUpdate)
} catch let err as NSError {
NSLog("%@", err)
XCTFail(err.localizedDescription)