From 53ebee195c8044e5bbb3990e7b5a7ac690af0e35 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Tue, 29 Aug 2017 12:38:29 +0300 Subject: [PATCH] Escape channel names in slugify helper correctly Fixes #1172. --- client/js/libs/handlebars/slugify.js | 4 +++- package.json | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/js/libs/handlebars/slugify.js b/client/js/libs/handlebars/slugify.js index a8b385e8..e30b8dd5 100644 --- a/client/js/libs/handlebars/slugify.js +++ b/client/js/libs/handlebars/slugify.js @@ -1,5 +1,7 @@ "use strict"; +const escape = require("css.escape"); + module.exports = function(orig) { - return orig.toLowerCase().replace(/[^a-z0-9]/, "-"); + return escape(orig.toLowerCase()); }; diff --git a/package.json b/package.json index cabf7a65..0d25b62e 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "babel-loader": "7.1.2", "babel-preset-env": "1.6.0", "chai": "4.1.1", + "css.escape": "1.5.1", "emoji-regex": "6.5.1", "eslint": "4.5.0", "font-awesome": "4.7.0",