Skip to content

Commit

Permalink
fix: ensure no leading or trailing whitespace on the string input (fl…
Browse files Browse the repository at this point in the history
…yteorg#206)

Signed-off-by: Pianist038801 <[email protected]>

Co-authored-by: Pianist038801 <[email protected]>
  • Loading branch information
Pianist038801 and Pianist038801 authored Sep 20, 2021
1 parent 0794e3c commit a9a1e9b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/Launch/LaunchForm/inputHelpers/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit a9a1e9b

Please sign in to comment.