Skip to content

Node.js based forum software built for the modern web

trim tag after substr

barisusakli962d14746ee9
diff --git a/src/topics/tags.js b/src/topics/tags.js
index 7723fb6640..0999584498 100644
--- a/src/topics/tags.js
+++ b/src/topics/tags.js
@@ -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];