From 1c9e7ff1dd5ef866a1856e2fed74b9ca65080e9c Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Sun, 24 Jan 2016 17:13:48 +0100 Subject: [PATCH] drop overly agressive email address character cleanup email addresses may contain UTF-8 characters in both the local part and/or domain part (see RFC 6531, RFC 6532, IDN). refs #2323, #2892 --- js/id/ui/entity_editor.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/js/id/ui/entity_editor.js b/js/id/ui/entity_editor.js index a0fc46e14..33c3b1bbc 100644 --- a/js/id/ui/entity_editor.js +++ b/js/id/ui/entity_editor.js @@ -158,16 +158,13 @@ iD.ui.EntityEditor = function(context) { // The code below is not intended to validate websites and emails. // It is only intended to prevent obvious copy-paste errors. (#2323) - // clean website-like tags - if (k.indexOf('website') !== -1 || cleaned.indexOf('http') === 0) { + // clean website- and email-like tags + if (k.indexOf('website') !== -1 || + k.indexOf('email') !== -1 || + cleaned.indexOf('http') === 0) { cleaned = cleaned .replace(/[\u200B-\u200F\uFEFF]/g, ''); // strip LRM and other zero width chars - // clean email-like tags - } else if (k.indexOf('email') !== -1) { - cleaned = cleaned - .replace(/[\u200B-\u200F\uFEFF]/g, '') // strip LRM and other zero width chars - .replace(/[^\w\+\-\.\/\?\|~!@#$%^&*'`{};=]/g, ''); // note: ';' allowed as OSM delimiter } return cleaned;