From 56c15cb7f5990bd87fc3cb227f4f87d57958171b Mon Sep 17 00:00:00 2001 From: Saku Laesvuori Date: Tue, 31 Oct 2023 18:18:31 +0200 Subject: [PATCH] Don't try to parse empty phone number fields --- frontend/src/Datarekisteri/Frontend/FormFields.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/Datarekisteri/Frontend/FormFields.hs b/frontend/src/Datarekisteri/Frontend/FormFields.hs index 0fae23a..d360d9c 100644 --- a/frontend/src/Datarekisteri/Frontend/FormFields.hs +++ b/frontend/src/Datarekisteri/Frontend/FormFields.hs @@ -33,6 +33,7 @@ telephoneField = Field { fieldParse = \rawValues _ -> case rawValues of [] -> pure $ Right Nothing + [""] -> pure $ Right Nothing [x] -> pure $ maybe (Left "could not parse as a phone number") (Right . Just) $ toPhoneNumber x _ -> pure $ Left $ "Expected one value" , fieldView = \id name otherAttributes result isRequired ->