mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 08:37:05 +02:00
fix: user image og:image
This commit is contained in:
@@ -20,6 +20,7 @@ const activitypub = require('../activitypub');
|
|||||||
const topicsController = module.exports;
|
const topicsController = module.exports;
|
||||||
|
|
||||||
const url = nconf.get('url');
|
const url = nconf.get('url');
|
||||||
|
const base_url = nconf.get('base_url');
|
||||||
const relative_path = nconf.get('relative_path');
|
const relative_path = nconf.get('relative_path');
|
||||||
const upload_url = nconf.get('upload_url');
|
const upload_url = nconf.get('upload_url');
|
||||||
const validSorts = ['oldest_to_newest', 'newest_to_oldest', 'most_votes'];
|
const validSorts = ['oldest_to_newest', 'newest_to_oldest', 'most_votes'];
|
||||||
@@ -356,8 +357,13 @@ function addOGImageTag(res, image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!imageUrl.startsWith('http')) {
|
if (!imageUrl.startsWith('http')) {
|
||||||
// (https://domain.com/forum) + (/assets/uploads) + (/files/imagePath)
|
if (imageUrl.startsWith(`${relative_path}${upload_url}`)) {
|
||||||
imageUrl = url + path.posix.join(upload_url, imageUrl);
|
// (https://domain.com) + imageUrl (which starts with /relative_path/upload_url)
|
||||||
|
imageUrl = base_url + imageUrl;
|
||||||
|
} else {
|
||||||
|
// (https://domain.com/forum) + (/assets/uploads) + (/files/imagePath)
|
||||||
|
imageUrl = url + path.posix.join(upload_url, imageUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res.locals.metaTags.push({
|
res.locals.metaTags.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user