diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 3b512388..9326758d 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -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 '<' diff --git a/Tests/Resources/testnamespaces.xml b/Tests/Resources/testnamespaces.xml index 4bfd7f89..a27e0d64 100644 --- a/Tests/Resources/testnamespaces.xml +++ b/Tests/Resources/testnamespaces.xml @@ -14,5 +14,22 @@ Sat, 26 Jul 2014 15:20:11 +0000 + + Version 4.0 + Sat, 26 Jul 2014 15:20:13 +0000 + + 2.5 + + https://sparkle-project.org + + + + Version 5.0 + Sat, 26 Jul 2014 15:20:14 +0000 + + + + + diff --git a/Tests/SUAppcastTest.swift b/Tests/SUAppcastTest.swift index e4224e2d..1e428a41 100644 --- a/Tests/SUAppcastTest.swift +++ b/Tests/SUAppcastTest.swift @@ -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 and 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)