testing thumb fix (#11727)

* testing thumb fix

* one more test

* remove logs
isekai-main
Barış Soner Uşaklı 2 years ago committed by GitHub
parent 0dde5d5fc7
commit 1abe1d5e01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 windows
uploads.push(...thumbs);
}

@ -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 }));

Loading…
Cancel
Save