Skip to content

Commit

Permalink
Improve regex in utils.parseVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Feb 19, 2021
1 parent 3f36c05 commit ab2811d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Expand Up @@ -69,7 +69,7 @@ export async function fetch(url: string): Promise<string> {
export async function parseVersion(version: string): Promise<string> {
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) {
Expand Down

0 comments on commit ab2811d

Please sign in to comment.