Skip to content

Commit

Permalink
coerce semver string before checking validity
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Webster committed Dec 3, 2024
1 parent 09ca65b commit 28fba21
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { InternalServerOptions, OptionTypeChecks } from "../types";
import { randomUUID } from "crypto";
import {normalize as normalizePath} from 'path'
import { tmpdir } from "os";
import { valid as validSemver } from "semver";
import { valid as validSemver, coerce as coerceSemver } from "semver";

export const MIN_SUPPORTED_MYSQL = '8.0.20';

Expand Down Expand Up @@ -41,7 +41,7 @@ export const INTERNAL_OPTIONS = ['_DO_NOT_USE_deleteDBAfterStopped', '_DO_NOT_US
const allowedArches = ['x64', 'arm64', undefined]
export const OPTION_TYPE_CHECKS: OptionTypeChecks = {
version: {
check: (opt: any) => opt === undefined || typeof opt === 'string' && validSemver(opt) !== null,
check: (opt: any) => opt === undefined || typeof opt === 'string' && validSemver(coerceSemver(opt)) !== null,
errorMessage: 'Option version must be either undefined or a valid semver string.',
definedType: 'string'
},
Expand Down

0 comments on commit 28fba21

Please sign in to comment.