From e717d8afc29ab03dd061e2e0fd672868425b8aa3 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 19 Jul 2023 20:12:59 +0100 Subject: [PATCH] fix: post images not include audio cover --- src/markdown/rehype-audio.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/markdown/rehype-audio.ts b/src/markdown/rehype-audio.ts index 51981a57..2bb77cba 100644 --- a/src/markdown/rehype-audio.ts +++ b/src/markdown/rehype-audio.ts @@ -24,15 +24,19 @@ export const rehypeAudio: Plugin, Root> = ({ node.properties.src = toGateway(src) + if (node.properties.cover && typeof node.properties.cover === "string") { + const coverIpfsUrl = toGateway(node.properties.cover) + node.properties.cover = coverIpfsUrl + env.images.push(coverIpfsUrl) + } + if (first) { if ( !env.cover && node.properties.cover && typeof node.properties.cover === "string" ) { - const coverIpfsUrl = toGateway(node.properties.cover) - node.properties.cover = coverIpfsUrl - env.cover = coverIpfsUrl + env.cover = node.properties.cover } env.audio = node.properties.src first = false