mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
fix: tests
This commit is contained in:
@@ -7,7 +7,7 @@ const topics = require('../../topics');
|
|||||||
const privileges = require('../../privileges');
|
const privileges = require('../../privileges');
|
||||||
|
|
||||||
const helpers = require('../helpers');
|
const helpers = require('../helpers');
|
||||||
const middleware = require('../../middleware/assert');
|
const middleware = require('../../middleware');
|
||||||
const uploadsController = require('../uploads');
|
const uploadsController = require('../uploads');
|
||||||
|
|
||||||
const Topics = module.exports;
|
const Topics = module.exports;
|
||||||
@@ -130,7 +130,7 @@ Topics.migrateThumbs = async (req, res) => {
|
|||||||
|
|
||||||
Topics.deleteThumb = async (req, res) => {
|
Topics.deleteThumb = async (req, res) => {
|
||||||
if (!req.body.path.startsWith('http')) {
|
if (!req.body.path.startsWith('http')) {
|
||||||
await middleware.assert.path(req, res);
|
await middleware.assert.path(req, res, function () {});
|
||||||
if (res.headersSent) {
|
if (res.headersSent) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
const validator = require('validator');
|
const validator = require('validator');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
var db = require('../database');
|
var db = require('../database');
|
||||||
var posts = require('../posts');
|
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
|
// Note: Backwards compatibility with old thumb logic, remove in v1.16.0
|
||||||
if (topicData.thumb && !topicData.thumbs.length) {
|
if (topicData.thumb && !topicData.thumbs.length) {
|
||||||
topicData.thumbs = [{
|
topicData.thumbs = [{
|
||||||
|
id: topicData.tid,
|
||||||
|
name: path.basename(topicData.thumb),
|
||||||
url: topicData.thumb,
|
url: topicData.thumb,
|
||||||
}];
|
}];
|
||||||
} else if (topicData.thumbs.length) {
|
} else if (topicData.thumbs.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user