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

Commit

Permalink
fix: '/link' controller was never responding.
Browse files Browse the repository at this point in the history
This update will correctly respond + will also set the image undefined in case it is.
  • Loading branch information
DevSlashRichie committed Oct 9, 2021
1 parent d03ec12 commit e081bfa
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions controllers/editorjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ const { LocalFileData } = require('get-file-object-from-local-path');
module.exports = {

link: async (ctx) => {
return await new Promise((resolve) => {
const result = await new Promise((resolve) => {
ogs(ctx.query, (error, results, response) => {

const imageUrl = (results.ogImage && results.ogImage.url) ? { url: results.ogImage.url } : undefined;

resolve({
success: 1,
meta: {
title: results.ogTitle,
description: results.ogDescription,
image: {
url: results.ogImage.url,
},
image: imageUrl,
},
})
})
})
});

ctx.send(result);
},

byFile: async (ctx) => {
Expand Down

0 comments on commit e081bfa

Please sign in to comment.