Skip to content

Commit 726aef5

Browse files
committed
Change regex implementation when validation questionnaire tags
1 parent 9a67f44 commit 726aef5

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

wizard-server/package.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ library:
6060
- raw-strings-qq
6161
- rdf4h
6262
- regex-compat
63+
- regex-tdfa
6364
- resource-pool
6465
- scientific
6566
- servant

wizard-server/src/Wizard/Service/Questionnaire/QuestionnaireValidation.hs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ module Wizard.Service.Questionnaire.QuestionnaireValidation where
33
import Control.Monad.Except (throwError)
44
import Data.Foldable (forM_, traverse_)
55
import qualified Data.Map.Strict as M
6-
import Data.Maybe (isJust)
76
import qualified Data.UUID as U
8-
import Text.Regex (matchRegex, mkRegex)
7+
import Text.Regex.TDFA
98

109
import Shared.Common.Localization.Messages.Public
1110
import Shared.Common.Model.Error.Error
@@ -35,8 +34,6 @@ validateQuestionnaireTag tag = forM_ (isValidProjectTag tag) throwError
3534

3635
isValidProjectTag :: String -> Maybe AppError
3736
isValidProjectTag tag =
38-
if isJust $ matchRegex validationRegex tag
37+
if tag =~ "^[^,]+$"
3938
then Nothing
4039
else Just $ ValidationError [] (M.singleton "tags" [_ERROR_VALIDATION__FORBIDDEN_CHARACTERS tag])
41-
where
42-
validationRegex = mkRegex "^[^,]+$"

0 commit comments

Comments
 (0)