fix(release): reject invalid Sparkle prerelease lanes · openclaw/openclaw@5290864
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -981,6 +981,9 @@ export function collectAppcastSparkleVersionErrors(xml: string): string[] {
|
981 | 981 | } |
982 | 982 | const floors = sparkleBuildFloorsFromShortVersion(shortVersion); |
983 | 983 | if (floors === null) { |
| 984 | +errors.push( |
| 985 | +`appcast item '${title}' has invalid sparkle:shortVersionString '${shortVersion}'.`, |
| 986 | +); |
984 | 987 | continue; |
985 | 988 | } |
986 | 989 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -73,7 +73,11 @@ export function sparkleBuildFloorsFromShortVersion(
|
73 | 73 | if (suffix.length > 0) { |
74 | 74 | const numericSuffix = /([0-9]+)$/.exec(suffix)?.[1]; |
75 | 75 | if (numericSuffix) { |
76 | | -lane = Math.min(Number.parseInt(numericSuffix, 10), 89); |
| 76 | +const parsedLane = Number(numericSuffix); |
| 77 | +if (!Number.isSafeInteger(parsedLane) || parsedLane < 1) { |
| 78 | +return null; |
| 79 | +} |
| 80 | +lane = Math.min(parsedLane, 89); |
77 | 81 | } else { |
78 | 82 | lane = 1; |
79 | 83 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -21,6 +21,11 @@ describe("canonicalSparkleBuildFromVersion", () => {
|
21 | 21 | expect(canonicalSparkleBuildFromVersion("2026.6.32-beta.1")).toBe(2606003201); |
22 | 22 | expect(canonicalSparkleBuildFromVersion("2026.6.32")).toBe(2606003290); |
23 | 23 | }); |
| 24 | + |
| 25 | +it("rejects invalid numeric prerelease lanes", () => { |
| 26 | +expect(canonicalSparkleBuildFromVersion("2026.6.5-beta.0")).toBeNull(); |
| 27 | +expect(canonicalSparkleBuildFromVersion("2026.6.5-beta.9007199254740993")).toBeNull(); |
| 28 | +}); |
24 | 29 | }); |
25 | 30 | |
26 | 31 | function parseItems(appcast: string): AppcastItem[] { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -80,6 +80,14 @@ describe("collectAppcastSparkleVersionErrors", () => {
|
80 | 80 | |
81 | 81 | expect(collectAppcastSparkleVersionErrors(xml)).toStrictEqual([]); |
82 | 82 | }); |
| 83 | + |
| 84 | +it("rejects appcast entries with invalid prerelease lanes", () => { |
| 85 | +const xml = `<rss><channel>${makeItem("2026.6.5-beta.0", "2606000500")}</channel></rss>`; |
| 86 | + |
| 87 | +expect(collectAppcastSparkleVersionErrors(xml)).toEqual([ |
| 88 | +"appcast item '2026.6.5-beta.0' has invalid sparkle:shortVersionString '2026.6.5-beta.0'.", |
| 89 | +]); |
| 90 | +}); |
83 | 91 | }); |
84 | 92 | |
85 | 93 | describe("packed CLI smoke", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。