trim tag after substr

this prevents spaces in the middle of the tag from being added to the db
This commit is contained in:
barisusakli
2014-11-13 15:02:20 -05:00
parent a45858dacd
commit 962d14746e

View File

@@ -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];