Skip to content
This repository was archived by the owner on Dec 23, 2023. It is now read-only.

Commit e081bfa

Browse files
fix: '/link' controller was never responding.
This update will correctly respond + will also set the image undefined in case it is.
1 parent d03ec12 commit e081bfa

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

controllers/editorjs.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@ const { LocalFileData } = require('get-file-object-from-local-path');
88
module.exports = {
99

1010
link: async (ctx) => {
11-
return await new Promise((resolve) => {
11+
const result = await new Promise((resolve) => {
1212
ogs(ctx.query, (error, results, response) => {
13+
14+
const imageUrl = (results.ogImage && results.ogImage.url) ? { url: results.ogImage.url } : undefined;
15+
1316
resolve({
1417
success: 1,
1518
meta: {
1619
title: results.ogTitle,
1720
description: results.ogDescription,
18-
image: {
19-
url: results.ogImage.url,
20-
},
21+
image: imageUrl,
2122
},
2223
})
2324
})
24-
})
25+
});
26+
27+
ctx.send(result);
2528
},
2629

2730
byFile: async (ctx) => {

0 commit comments

Comments
 (0)