mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 13:26:02 +02:00
fix: thumbs.get to handle null case from mime.getType
This commit is contained in:
@@ -74,9 +74,10 @@ Thumbs.get = async function (tids, options) {
|
|||||||
const mainPidUploads = await Promise.all(mainPids.map(async pid => await posts.uploads.list(pid)));
|
const mainPidUploads = await Promise.all(mainPids.map(async pid => await posts.uploads.list(pid)));
|
||||||
mainPidUploads.forEach((uploads, idx) => {
|
mainPidUploads.forEach((uploads, idx) => {
|
||||||
uploads = uploads.map(path => `/${path}`);
|
uploads = uploads.map(path => `/${path}`);
|
||||||
uploads = uploads.filter(
|
uploads = uploads.filter((upload) => {
|
||||||
upload => !thumbs[idx].includes(upload) && mime.getType(upload).startsWith('image/')
|
const type = mime.getType(upload);
|
||||||
);
|
return !thumbs[idx].includes(upload) && type && type.startsWith('image/');
|
||||||
|
});
|
||||||
|
|
||||||
if (uploads.length) {
|
if (uploads.length) {
|
||||||
thumbs[idx].push(...uploads);
|
thumbs[idx].push(...uploads);
|
||||||
|
|||||||
Reference in New Issue
Block a user