mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-04-19 00:26:53 +00:00
Fix some RegEx io-ts types
io-ts types that were generated using `shortStringWithRegex` were testing against `VAR_NAME_REGEX`, instead of the Regex that was specified when generating the type. This affected `DockerName` such that service names with a dash in the middle were returning as false when passed through the `DockerName.is` type guard, affecting how `getServicesLockedByAppId` was returning a map of locked services. Change-type: patch Signed-off-by: Christina Ying Wang <christina@balena.io>
This commit is contained in:
parent
aa00727f45
commit
b7922e6875
@ -96,7 +96,7 @@ const CONFIG_VAR_NAME_REGEX = /^[a-zA-Z_][a-zA-Z0-9_:]*$/;
|
||||
const shortStringWithRegex = (name: string, regex: RegExp, message: string) =>
|
||||
new t.Type<string, string>(
|
||||
name,
|
||||
(s: unknown): s is string => ShortString.is(s) && VAR_NAME_REGEX.test(s),
|
||||
(s: unknown): s is string => ShortString.is(s) && regex.test(s),
|
||||
(i, c) =>
|
||||
pipe(
|
||||
ShortString.validate(i, c),
|
||||
|
Loading…
x
Reference in New Issue
Block a user