From ab2811dff7d55518275df9aa6b5b405b3b153713 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Fri, 5 Feb 2021 04:42:33 +0530 Subject: [PATCH] Improve regex in utils.parseVersion --- dist/index.js | 2 +- src/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 75cbe17ea..18b3c42a0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1121,7 +1121,7 @@ exports.fetch = fetch; async function parseVersion(version) { const manifest = 'https://dl.bintray.com/shivammathur/php/php-versions.json'; switch (true) { - case /latest|\d.x/.test(version): + case /^(latest|\d+\.x)$/.test(version): return JSON.parse(await fetch(manifest))[version]; default: switch (true) { diff --git a/src/utils.ts b/src/utils.ts index cb3af9c09..4e42f4a80 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -69,7 +69,7 @@ export async function fetch(url: string): Promise { export async function parseVersion(version: string): Promise { const manifest = 'https://dl.bintray.com/shivammathur/php/php-versions.json'; switch (true) { - case /latest|\d.x/.test(version): + case /^(latest|\d+\.x)$/.test(version): return JSON.parse(await fetch(manifest))[version]; default: switch (true) {