From f7e61189fd88f466138de458786e451d243c3e79 Mon Sep 17 00:00:00 2001 From: filesite Date: Fri, 19 Apr 2024 08:10:34 +0800 Subject: [PATCH] bug fix for no cover image --- lib/tajian.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tajian.mjs b/lib/tajian.mjs index 153c517..e4dd58d 100644 --- a/lib/tajian.mjs +++ b/lib/tajian.mjs @@ -45,6 +45,7 @@ class TaJian { let content = data.title; await writeFile(filepath, content, { encoding: 'utf8' }); + //save cover image if (typeof(data.cover_base64) != 'undefined' && data.cover_base64) { filepath = `${dirPath}/${filename}.${data.cover_type}`; content = Buffer.from(data.cover_base64, "base64"); //保存图片文件 @@ -53,7 +54,7 @@ class TaJian { filepath = `${dirPath}/${filename}_cover.txt`; content = `${filename}.${data.cover_type}`; //保存图片路径 await writeFile(filepath, content, { encoding: 'utf8' }); - }else { + }else if (typeof(data.cover) != 'undefined' && data.cover) { filepath = `${dirPath}/${filename}_cover.txt`; content = data.cover; //保存图片网址 await writeFile(filepath, content, { encoding: 'utf8' });