From 21e34394d06300d63a95aa1e27ef20627aed03fd Mon Sep 17 00:00:00 2001 From: jj Date: Sat, 12 Jul 2025 20:13:46 +0200 Subject: [PATCH] Add support for relative urls for delta updates (#2741) --- Sparkle/SUAppcastItem.m | 2 +- Tests/Resources/test-relative-urls.xml | 4 ++++ Tests/SUAppcastTest.swift | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index 43868120..1e462588 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -335,7 +335,7 @@ static NSString *SUAppcastItemDeltaFromSparkleLocalesKey = @"SUAppcastItemDeltaF // Initializer used for making delta items - (nullable instancetype)initWithDictionary:(NSDictionary *)dict relativeToURL:(NSURL * _Nullable)appcastURL state:(SPUAppcastItemState * _Nullable)state SPU_OBJC_DIRECT { - return [self initWithDictionary:dict relativeToURL:nil stateResolver:nil resolvedState:state failureReason:nil]; + return [self initWithDictionary:dict relativeToURL:appcastURL stateResolver:nil resolvedState:state failureReason:nil]; } // Exported public initializer diff --git a/Tests/Resources/test-relative-urls.xml b/Tests/Resources/test-relative-urls.xml index 6eea684a..c742a672 100644 --- a/Tests/Resources/test-relative-urls.xml +++ b/Tests/Resources/test-relative-urls.xml @@ -7,6 +7,10 @@ Sat, 26 Jul 2014 15:20:12 +0000 notes/relnote-3.0.txt + + + + Version 2.0 diff --git a/Tests/SUAppcastTest.swift b/Tests/SUAppcastTest.swift index 0392c824..514da715 100644 --- a/Tests/SUAppcastTest.swift +++ b/Tests/SUAppcastTest.swift @@ -998,6 +998,11 @@ class SUAppcastTest: XCTestCase { XCTAssertEqual("https://fake.sparkle-project.org/updates/release-3.0.zip", items[0].fileURL?.absoluteString) XCTAssertEqual("https://fake.sparkle-project.org/updates/notes/relnote-3.0.txt", items[0].releaseNotesURL?.absoluteString) + XCTAssertEqual(2, items[0].deltaUpdates!.count) + + XCTAssertEqual("https://fake.sparkle-project.org/updates/3.0_from_2.0.delta", items[0].deltaUpdates!["2.0"]!.fileURL?.absoluteString) + XCTAssertEqual("https://fake.sparkle-project.org/updates/3.0_from_1.0.delta", items[0].deltaUpdates!["1.0"]!.fileURL?.absoluteString) + XCTAssertEqual("https://fake.sparkle-project.org/info/info-2.0.txt", items[1].infoURL?.absoluteString) XCTAssertEqual("https://fake.sparkle-project.org/updates/notes/fullnotes.txt", items[2].fullReleaseNotesURL?.absoluteString)