fix: convert param to string in slugify

fixes adding users to privilege table
v1.18.x
Barış Soner Uşaklı 5 years ago
parent 9b308e4b07
commit 441dd86d29

@ -351,7 +351,7 @@
if (!str) {
return '';
}
str = str.replace(utils.trimRegex, '');
str = String(str).replace(utils.trimRegex, '');
if (utils.isLatin.test(str)) {
str = str.replace(utils.invalidLatinChars, '-');
} else {

@ -46,6 +46,12 @@ describe('Utility Methods', function () {
done();
});
it('should work if a number is passed in', function (done) {
var slug = utils.slugify(12345);
assert.strictEqual(slug, '12345');
done();
});
describe('username validation', function () {
it('accepts latin-1 characters', function () {
var username = "John\"'-. Doeäâèéë1234";

Loading…
Cancel
Save