mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-01 01:51:18 +01:00
testing thumb fix (#11727)
* testing thumb fix * one more test * remove logs
This commit is contained in:
committed by
GitHub
parent
0dde5d5fc7
commit
1abe1d5e01
@@ -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 }));
|
||||
|
||||
Reference in New Issue
Block a user