mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
fixing crash when utils.slugify is called with a null value
This commit is contained in:
@@ -75,6 +75,7 @@
|
|||||||
|
|
||||||
//http://dense13.com/blog/2009/05/03/converting-string-to-slug-javascript/
|
//http://dense13.com/blog/2009/05/03/converting-string-to-slug-javascript/
|
||||||
slugify: function(str) {
|
slugify: function(str) {
|
||||||
|
if (!str) { str = ''; }
|
||||||
str = str.replace(utils.trimRegex, '');
|
str = str.replace(utils.trimRegex, '');
|
||||||
if(utils.isLatin.test(str)) {
|
if(utils.isLatin.test(str)) {
|
||||||
str = str.replace(utils.invalidLatinChars, '-');
|
str = str.replace(utils.invalidLatinChars, '-');
|
||||||
|
|||||||
Reference in New Issue
Block a user