From f03b7a957c3773ace2c291f7ad01b616de2f6e0c Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Thu, 31 Mar 2022 16:24:00 -0300 Subject: [PATCH] Harden email split --- .../maps-page/action-dispatcher/share-dialog/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx b/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx index d0290cac..77d5efbc 100644 --- a/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx +++ b/packages/webapp/src/components/maps-page/action-dispatcher/share-dialog/index.tsx @@ -114,7 +114,11 @@ const ShareDialog = ({ mapId, onClose }: SimpleDialogProps): React.ReactElement }; // very basic email validation, just make sure the basic syntax is fine - const isValid = model.emails.split(',').every(str => /\S+@\S+\.\S+/.test((str || '').trim())); + const isValid = model.emails + .split(/,|;/) + .filter(e => e.trim().length > 0) + .every(str => /\S+@\S+\.\S+/.test((str || '') + .trim())); return (