trim tag after substr

this prevents spaces in the middle of the tag from being added to the db
v1.18.x
barisusakli 10 years ago
parent a45858dacd
commit 962d14746e

@ -49,7 +49,7 @@ module.exports = function(Topics) {
}
tag = tag.trim().toLowerCase();
tag = tag.replace(/[,\/#!$%\^\*;:{}=_`<>'"~()?\|]/g, '');
tag = tag.substr(0, meta.config.maximumTagLength || 15);
tag = tag.substr(0, meta.config.maximumTagLength || 15).trim();
var matches = tag.match(/^[.-]*(.+?)[.-]*$/);
if (matches && matches.length > 1) {
tag = matches[1];

Loading…
Cancel
Save