Handle legacy OpenJDK URL layout

This commit is contained in:
copilot-swe-agent[bot]
2026-07-28 02:35:20 +00:00
committed by GitHub
parent 2c4a2dda70
commit cb48866ec3
3 changed files with 4 additions and 3 deletions
@@ -176,12 +176,13 @@ describe('OpenJdkDistribution', () => {
'x64' 'x64'
); );
const windowsRelease = distribution['parseReleases']( const windowsRelease = distribution['parseReleases'](
'<a href="https://download.java.net/java/GA/jdk10/hash/13/GPL/openjdk-10_windows-x64_bin.tar.gz">tar.gz</a>', '<a href="https://download.java.net/java/GA/jdk10/hash/13/openjdk-10.0.2_windows-x64_bin.tar.gz">tar.gz</a>',
'windows', 'windows',
'x64' 'x64'
); );
expect(macRelease[0].version).toBe('16.0.0+7'); expect(macRelease[0].version).toBe('16.0.0+7');
expect(windowsRelease[0].version).toBe('10.0.2+13');
expect(windowsRelease[0].url.endsWith('.tar.gz')).toBe(true); expect(windowsRelease[0].url.endsWith('.tar.gz')).toBe(true);
}); });
+1 -1
View File
@@ -131939,7 +131939,7 @@ class OpenJdkDistribution extends JavaBase {
const pattern = new RegExp(`href="(https://download\\.java\\.net/[^"]+/openjdk-([^"_]+)_${platformPattern}-${arch}_bin\\.${extensionPattern})"`, 'g'); const pattern = new RegExp(`href="(https://download\\.java\\.net/[^"]+/openjdk-([^"_]+)_${platformPattern}-${arch}_bin\\.${extensionPattern})"`, 'g');
return Array.from(html.matchAll(pattern), match => { return Array.from(html.matchAll(pattern), match => {
const url = match[1]; const url = match[1];
const build = url.match(/\/(\d+)\/GPL\/openjdk-/)?.[1]; const build = url.match(/\/(\d+)\/(?:GPL\/)?openjdk-/)?.[1];
return { return {
version: this.toSemver(match[2], build), version: this.toSemver(match[2], build),
url url
+1 -1
View File
@@ -126,7 +126,7 @@ export class OpenJdkDistribution extends JavaBase {
return Array.from(html.matchAll(pattern), match => { return Array.from(html.matchAll(pattern), match => {
const url = match[1]; const url = match[1];
const build = url.match(/\/(\d+)\/GPL\/openjdk-/)?.[1]; const build = url.match(/\/(\d+)\/(?:GPL\/)?openjdk-/)?.[1];
return { return {
version: this.toSemver(match[2], build), version: this.toSemver(match[2], build),
url url