mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-29 03:59:54 +02:00
Allow mutation of guide template for HTML unescaping (#8816)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
This commit is contained in:
@@ -241,19 +241,19 @@ async function generateGuideOpenGraph() {
|
|||||||
const image =
|
const image =
|
||||||
author?.imageUrl || 'https://roadmap.sh/images/default-avatar.png';
|
author?.imageUrl || 'https://roadmap.sh/images/default-avatar.png';
|
||||||
const isExternalImage = image?.startsWith('http');
|
const isExternalImage = image?.startsWith('http');
|
||||||
let authorImageExtention = '';
|
let authorImageExtension = '';
|
||||||
let authorAvatar;
|
let authorAvatar;
|
||||||
if (!isExternalImage) {
|
if (!isExternalImage) {
|
||||||
authorAvatar = await fs.readFile(path.join(ALL_AUTHOR_IMAGE_DIR, image));
|
authorAvatar = await fs.readFile(path.join(ALL_AUTHOR_IMAGE_DIR, image));
|
||||||
authorImageExtention = image?.split('.')[1];
|
authorImageExtension = image?.split('.')[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
const template = getGuideTemplate({
|
let template = getGuideTemplate({
|
||||||
...guide,
|
...guide,
|
||||||
authorName: author.name,
|
authorName: author.name,
|
||||||
authorAvatar: isExternalImage
|
authorAvatar: isExternalImage
|
||||||
? image
|
? image
|
||||||
: `data:image/${authorImageExtention};base64,${authorAvatar.toString('base64')}`,
|
: `data:image/${authorImageExtension};base64,${authorAvatar.toString('base64')}`,
|
||||||
});
|
});
|
||||||
if (
|
if (
|
||||||
hasSpecialCharacters(guide.title) ||
|
hasSpecialCharacters(guide.title) ||
|
||||||
|
Reference in New Issue
Block a user