Skip to content

Commit

Permalink
fix(FOROME-1373): invalidate spaces in preset names (#848)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniySobolev authored Aug 1, 2022
1 parent a2ec669 commit a0e2a5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/utils/validation/validatePresetName.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import {
noFirstNumberPattern,
noFirstSymbolsPattern,
noSpacesPattern,
} from './validationPatterns'

export const validatePresetName = (presetName: string): boolean => {
if (
!presetName ||
noFirstSymbolsPattern.test(presetName) ||
noFirstNumberPattern.test(presetName) ||
noSpacesPattern.test(presetName) ||
presetName.length > 50
) {
return false
Expand Down
2 changes: 2 additions & 0 deletions src/utils/validation/validationPatterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ export const noFirstSymbolsPattern = /^[!"#$%&'()*+,./:;<=>?@[\\\]^_`{|}~§±№

export const noSymbolPattern = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~§±-]/

export const noSpacesPattern = /\s/

export const noFirstNumberPattern = /^[\d_]/

0 comments on commit a0e2a5d

Please sign in to comment.