Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
aef5ea64d0 |
@@ -142,7 +142,7 @@ describe('setup-go', () => {
|
|||||||
os.platform = 'darwin';
|
os.platform = 'darwin';
|
||||||
os.arch = 'x64';
|
os.arch = 'x64';
|
||||||
|
|
||||||
const match = await im.getInfoFromManifest('1.9.7', true, 'mocktoken');
|
const match = await im.getInfoFromManifest('1.21', true, 'mocktoken');
|
||||||
expect(match).toBeDefined();
|
expect(match).toBeDefined();
|
||||||
expect(match!.resolvedVersion).toBe('1.9.7');
|
expect(match!.resolvedVersion).toBe('1.9.7');
|
||||||
expect(match!.type).toBe('manifest');
|
expect(match!.type).toBe('manifest');
|
||||||
|
10
dist/setup/index.js
vendored
10
dist/setup/index.js
vendored
@@ -61594,12 +61594,14 @@ function getManifestFromRepo(owner, repo, auth, branch = 'master') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
headers['accept'] = 'application/vnd.github.VERSION.raw';
|
headers['accept'] = 'application/vnd.github.VERSION.raw';
|
||||||
let versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody();
|
const versionsRaw = yield (yield http.get(manifestUrl, headers)).readBody();
|
||||||
if (versionsRaw) {
|
const base64 = JSON.parse(versionsRaw);
|
||||||
|
let tmp = Buffer.from(base64['content'], 'base64').toString('ascii');
|
||||||
|
if (tmp) {
|
||||||
// shouldn't be needed but protects against invalid json saved with BOM
|
// shouldn't be needed but protects against invalid json saved with BOM
|
||||||
versionsRaw = versionsRaw.replace(/^\uFEFF/, '');
|
tmp = tmp.replace(/^\uFEFF/, '');
|
||||||
try {
|
try {
|
||||||
releases = JSON.parse(versionsRaw);
|
releases = JSON.parse(tmp);
|
||||||
}
|
}
|
||||||
catch (_a) {
|
catch (_a) {
|
||||||
core.debug('Invalid json');
|
core.debug('Invalid json');
|
||||||
|
@@ -321,13 +321,17 @@ export async function getManifestFromRepo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
headers['accept'] = 'application/vnd.github.VERSION.raw';
|
headers['accept'] = 'application/vnd.github.VERSION.raw';
|
||||||
let versionsRaw = await (await http.get(manifestUrl, headers)).readBody();
|
const versionsRaw = await (await http.get(manifestUrl, headers)).readBody();
|
||||||
|
|
||||||
if (versionsRaw) {
|
const base64 = JSON.parse(versionsRaw);
|
||||||
|
|
||||||
|
let tmp = Buffer.from(base64['content'], 'base64').toString('ascii');
|
||||||
|
|
||||||
|
if (tmp) {
|
||||||
// shouldn't be needed but protects against invalid json saved with BOM
|
// shouldn't be needed but protects against invalid json saved with BOM
|
||||||
versionsRaw = versionsRaw.replace(/^\uFEFF/, '');
|
tmp = tmp.replace(/^\uFEFF/, '');
|
||||||
try {
|
try {
|
||||||
releases = JSON.parse(versionsRaw);
|
releases = JSON.parse(tmp);
|
||||||
} catch {
|
} catch {
|
||||||
core.debug('Invalid json');
|
core.debug('Invalid json');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user