From e6a413504dc38b1c0ac89ddbca556adc428a5cd5 Mon Sep 17 00:00:00 2001 From: Pianist038801 Date: Mon, 20 Sep 2021 08:35:10 -0400 Subject: [PATCH] fix: ensure no leading or trailing whitespace on the string input Signed-off-by: Pianist038801 --- src/components/Launch/LaunchForm/inputHelpers/string.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/Launch/LaunchForm/inputHelpers/string.ts b/src/components/Launch/LaunchForm/inputHelpers/string.ts index ec5c55b79..7bb2d8bd9 100644 --- a/src/components/Launch/LaunchForm/inputHelpers/string.ts +++ b/src/components/Launch/LaunchForm/inputHelpers/string.ts @@ -20,6 +20,12 @@ function validate({ value }: InputValidatorParams) { if (typeof value !== 'string') { throw new Error('Value is not a string'); } + if (value && value[0] === ' ') { + throw new Error('Value should not have a leading space'); + } + if (value && value[value.length - 1] === ' ') { + throw new Error('Value should not have a trailing space'); + } } export const stringHelper: InputHelper = {