From 7565a07922e9a558eab8d9f94c943651ca36165b Mon Sep 17 00:00:00 2001 From: Leo Camus Date: Sun, 13 Sep 2026 17:13:54 +0200 Subject: [PATCH] Fix reading release notes content length from appcast (#2921) --- Sparkle/SUAppcastItem.m | 2 +- Tests/Resources/test-links.xml | 2 +- Tests/SUAppcastTest.swift | 2 ++ Tests/Sparkle Unit Tests-Bridging-Header.h | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index 47a37705..29a29a37 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -843,7 +843,7 @@ static NSString *SPUSanitizeUntrustedVersionString(NSString *versionString, NSSt #endif ]; - long long releaseNotesLength = [(NSString *)[releaseNotesLinkDictionary objectForKey:@"length"] longLongValue]; + long long releaseNotesLength = [(NSString *)[releaseNotesLinkDictionary objectForKey:SUAppcastAttributeLength] longLongValue]; _releaseNotesContentLength = (releaseNotesLength > 0) ? (uint64_t)releaseNotesLength : 0; } diff --git a/Tests/Resources/test-links.xml b/Tests/Resources/test-links.xml index 8bddbd10..4b1ebd5a 100644 --- a/Tests/Resources/test-links.xml +++ b/Tests/Resources/test-links.xml @@ -5,7 +5,7 @@ Version 3.0 Sat, 26 Jul 2014 15:20:12 +0000 - https://sparkle-project.org/notes/relnote-3.0.txt + https://sparkle-project.org/notes/relnote-3.0.txt https://sparkle-project.org/fullnotes.txt https://sparkle-project.org diff --git a/Tests/SUAppcastTest.swift b/Tests/SUAppcastTest.swift index cbc9b193..e4224e2d 100644 --- a/Tests/SUAppcastTest.swift +++ b/Tests/SUAppcastTest.swift @@ -1037,12 +1037,14 @@ class SUAppcastTest: XCTestCase { // Test https XCTAssertEqual("https://sparkle-project.org/notes/relnote-3.0.txt", items[0].releaseNotesURL?.absoluteString) + XCTAssertEqual(1234, items[0].releaseNotesContentLength) XCTAssertEqual("https://sparkle-project.org/fullnotes.txt", items[0].fullReleaseNotesURL?.absoluteString) XCTAssertEqual("https://sparkle-project.org", items[0].infoURL?.absoluteString) XCTAssertEqual("https://sparkle-project.org/release-3.0.zip", items[0].fileURL?.absoluteString) // Test http XCTAssertEqual("http://sparkle-project.org/notes/relnote-2.0.txt", items[1].releaseNotesURL?.absoluteString) + XCTAssertEqual(0, items[1].releaseNotesContentLength) XCTAssertEqual("http://sparkle-project.org/fullnotes.txt", items[1].fullReleaseNotesURL?.absoluteString) XCTAssertEqual("http://sparkle-project.org", items[1].infoURL?.absoluteString) XCTAssertEqual("http://sparkle-project.org/release-2.0.zip", items[1].fileURL?.absoluteString) diff --git a/Tests/Sparkle Unit Tests-Bridging-Header.h b/Tests/Sparkle Unit Tests-Bridging-Header.h index b4be4753..a4706be5 100644 --- a/Tests/Sparkle Unit Tests-Bridging-Header.h +++ b/Tests/Sparkle Unit Tests-Bridging-Header.h @@ -12,6 +12,7 @@ #import "SUAppcast.h" #import "SUAppcast+Private.h" #import "SUAppcastItem.h" +#import "SUAppcastItem+Private.h" #import "SUAppcastDriver.h" #import "SUVersionComparisonProtocol.h" #import "SUStandardVersionComparator.h"