Skip to content

Node.js based forum software built for the modern web

handle relative images

Barış Soner Uşaklıaa1d22ec796d
diff --git a/src/controllers/topics.js b/src/controllers/topics.js
index 548b8eceb2..491d37d1e0 100644
--- a/src/controllers/topics.js
+++ b/src/controllers/topics.js
@@ -288,7 +288,7 @@ function addTags(topicData, req, res) {
},
];
- var regex = /src\s*=\s*"(.+?)"/g;
+ var regex = /src\s*=\s*"(.+?)"/;
topicData.posts.forEach(function (postData) {
var match = regex.exec(postData.content);
@@ -297,6 +297,9 @@ function addTags(topicData, req, res) {
if (image.startsWith(nconf.get('url') + '/plugins')) {
return;
}
+ if (!image.startsWith('http')) {
+ image = nconf.get('url') + image;
+ }
res.locals.metaTags.push({
property: 'og:image',
content: image,