mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
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:
1 parent
efc9a22635
commit
07db2480ad
3 files changed
+27
-4
No files matched your search
Vendored
+4
-3
@@ -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 '<'
|
||||
|
||||
@@ -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>
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user