From 9e83c42200b8bbfda40f30248d89a985c5b95101 Mon Sep 17 00:00:00 2001 From: Alf Eaton <75253002+aeaton-overleaf@users.noreply.github.com> Date: Tue, 27 Apr 2021 08:36:15 +0100 Subject: [PATCH] Merge pull request #3948 from overleaf/ae-invite-spaces Remove spaces from invited email addresses GitOrigin-RevId: 034c4e7297561b9195248eb8a52cd1f800940b6d --- .../components/select-collaborators.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/share-project-modal/components/select-collaborators.js b/services/web/frontend/js/features/share-project-modal/components/select-collaborators.js index 89ce4eeb22..e5a63c588c 100644 --- a/services/web/frontend/js/features/share-project-modal/components/select-collaborators.js +++ b/services/web/frontend/js/features/share-project-modal/components/select-collaborators.js @@ -7,6 +7,11 @@ import classnames from 'classnames' import Icon from '../../../shared/components/icon' +// Unicode characters in these Unicode groups: +// "General Punctuation — Spaces" +// "General Punctuation — Format character" (including zero-width spaces) +const matchAllSpaces = /[\u061C\u2000-\u200F\u202A-\u202E\u2060\u2066-\u2069\u2028\u2029\u202F]/g + export default function SelectCollaborators({ loading, options, @@ -98,7 +103,9 @@ export default function SelectCollaborators({ }) const addNewItem = useCallback( - (email, focus = true) => { + (_email, focus = true) => { + const email = _email.replace(matchAllSpaces, '') + if ( isValidInput && email.includes('@') &&