mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
test both max length and pattern if declared
This commit is contained in:
parent
928ddd69a9
commit
3b831fecb8
1 changed files with 4 additions and 2 deletions
|
|
@ -25,7 +25,8 @@ export class SanitizedString extends GraphQLScalarType {
|
|||
throw new Error(
|
||||
`Specified value cannot be longer than ${maxLength} characters`
|
||||
)
|
||||
} else if (pattern && !pattern.test(value)) {
|
||||
}
|
||||
if (pattern && !pattern.test(value)) {
|
||||
throw new Error(`Specified value does not match pattern`)
|
||||
}
|
||||
return sanitize(value, { allowedTags: allowedTags || [] })
|
||||
|
|
@ -38,7 +39,8 @@ export class SanitizedString extends GraphQLScalarType {
|
|||
throw new Error(
|
||||
`Specified value cannot be longer than ${maxLength} characters`
|
||||
)
|
||||
} else if (pattern && !pattern.test(value)) {
|
||||
}
|
||||
if (pattern && !pattern.test(value)) {
|
||||
throw new Error(`Specified value does not match pattern`)
|
||||
}
|
||||
return sanitize(value, { allowedTags: allowedTags || [] })
|
||||
|
|
|
|||
Loading…
Reference in a new issue