diff --git a/package-lock.json b/package-lock.json index 85b9015b..867093af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -508,7 +508,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "requires": { "inherits": "2.0.1" diff --git a/routes/_utils/replaceEmoji.js b/routes/_utils/replaceEmoji.js index 12df946e..b27f3c04 100644 --- a/routes/_utils/replaceEmoji.js +++ b/routes/_utils/replaceEmoji.js @@ -9,7 +9,7 @@ export function replaceEmoji (string, replacer) { function safeReplacer (substring) { // emoji regex matches digits and pound sign https://git.io/fpl6J - if (substring.match(/^[0-9#]+$/)) { + if (substring.match(/^[0-9#*]+$/)) { return substring } return replacer(substring) diff --git a/tests/unit/test-emoji.js b/tests/unit/test-emoji.js index fc7152b8..d827120c 100644 --- a/tests/unit/test-emoji.js +++ b/tests/unit/test-emoji.js @@ -60,12 +60,16 @@ describe('test-emoji.js', function () { ) }) - it('does not replace digits or pound', function () { + it('does not replace non-emoji characters', function () { let replacer = _ => `
${_}
` assert.strictEqual( replaceEmoji(`it's over #9000`, replacer), `it's over #9000` ) + assert.strictEqual( + replaceEmoji(`woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£`, replacer), + `woot !@#$%^&*()~` + '`' + `{[}]:;"'<,>.?/£` + ) }) it('does not replace emoji inside HTML tags', function () {