Skip to content

Commit 1015386

Browse files
Merge pull request #161 from Sebastian-Webster/160-not-quite-valid-semver-strings-fail-value-checks-for-version-option
Fix not quite valid semver strings not being able to be used for the MySQL DB version
2 parents 09ca65b + 28fba21 commit 1015386

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { InternalServerOptions, OptionTypeChecks } from "../types";
22
import { randomUUID } from "crypto";
33
import {normalize as normalizePath} from 'path'
44
import { tmpdir } from "os";
5-
import { valid as validSemver } from "semver";
5+
import { valid as validSemver, coerce as coerceSemver } from "semver";
66

77
export const MIN_SUPPORTED_MYSQL = '8.0.20';
88

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

0 commit comments

Comments
 (0)