Skip to content

Node.js based forum software built for the modern web

closes #2003

barisusaklie751a0c0cf74
diff --git a/src/posts.js b/src/posts.js
index 1392ac0372..a2c691dc28 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -336,6 +336,14 @@ var async = require('async'),
return obj;
}
+ function stripTags(content) {
+ if (options.stripTags && content) {
+ var s = S(content);
+ return s.stripTags.apply(s, utils.stripTags).s;
+ }
+ return content;
+ }
+
if (err) {
return callback(err);
}
@@ -361,6 +369,7 @@ var async = require('async'),
post.relativeTime = utils.toISOString(post.timestamp);
if (!post.content || !options.parse) {
+ post.content = stripTags(post.content);
return next(null, post);
}
@@ -369,12 +378,7 @@ var async = require('async'),
return next(err);
}
- if (options.stripTags && content) {
- var s = S(content);
- post.content = s.stripTags.apply(s, utils.stripTags).s;
- } else {
- post.content = content;
- }
+ post.content = stripTags(content);
next(null, post);
});