Node.js based forum software built for the modern web
testing thumb fix (#11727)
Barış Soner Uşaklı1abe1d5e0123
diff --git a/src/posts/uploads.js b/src/posts/uploads.jsindex c8c12999d5..3ab2a6aeb4 100644--- a/src/posts/uploads.js+++ b/src/posts/uploads.js@@ -64,10 +64,10 @@ module.exports = function (Posts) {if (isMainPost) {const tid = await Posts.getPostField(pid, 'tid');let thumbs = await topics.thumbs.get(tid);- const replacePath = path.posix.join(`${nconf.get('relative_path')}${nconf.get('upload_url')}/`);- thumbs = thumbs.map(thumb => thumb.url.replace(replacePath, '')).filter(path => !validator.isURL(path, {+ thumbs = thumbs.map(thumb => thumb.path).filter(path => !validator.isURL(path, {require_protocol: true,}));+ thumbs = thumbs.map(t => t.slice(1)); // remove leading `/` or `\\` on windowsuploads.push(...thumbs);}diff --git a/src/topics/thumbs.js b/src/topics/thumbs.jsindex 60db184339..f6dcdd2187 100644--- a/src/topics/thumbs.js+++ b/src/topics/thumbs.js@@ -53,7 +53,7 @@ Thumbs.get = async function (tids) {return hasTimestampPrefix.test(name) ? name.slice(14) : name;})(),path: thumb,- url: thumb.startsWith('http') ? thumb : path.posix.join(upload_url, thumb),+ url: thumb.startsWith('http') ? thumb : path.posix.join(upload_url, thumb.replace(/\\/g, '/')),})));({ thumbs: response } = await plugins.hooks.fire('filter:topics.getThumbs', { tids, thumbs: response }));