Skip to content

Node.js based forum software built for the modern web

fix: tests

Julian Lambd5c4a5cffb4
diff --git a/src/controllers/write/topics.js b/src/controllers/write/topics.js
index fbf21e333b..c91654530b 100644
--- a/src/controllers/write/topics.js
+++ b/src/controllers/write/topics.js
@@ -7,7 +7,7 @@ const topics = require('../../topics');
const privileges = require('../../privileges');
const helpers = require('../helpers');
-const middleware = require('../../middleware/assert');
+const middleware = require('../../middleware');
const uploadsController = require('../uploads');
const Topics = module.exports;
@@ -130,7 +130,7 @@ Topics.migrateThumbs = async (req, res) => {
Topics.deleteThumb = async (req, res) => {
if (!req.body.path.startsWith('http')) {
- await middleware.assert.path(req, res);
+ await middleware.assert.path(req, res, function () {});
if (res.headersSent) {
return;
}
diff --git a/src/topics/index.js b/src/topics/index.js
index f4455606cc..d74800f972 100644
--- a/src/topics/index.js
+++ b/src/topics/index.js
@@ -2,6 +2,7 @@
var _ = require('lodash');
const validator = require('validator');
+const path = require('path');
var db = require('../database');
var posts = require('../posts');
@@ -172,6 +173,8 @@ Topics.getTopicWithPosts = async function (topicData, set, uid, start, stop, rev
// Note: Backwards compatibility with old thumb logic, remove in v1.16.0
if (topicData.thumb && !topicData.thumbs.length) {
topicData.thumbs = [{
+ id: topicData.tid,
+ name: path.basename(topicData.thumb),
url: topicData.thumb,
}];
} else if (topicData.thumbs.length) {