Browse Source

bug fix for no cover image

master
filesite 7 months ago
parent
commit
f7e61189fd
  1. 3
      lib/tajian.mjs

3
lib/tajian.mjs

@ -45,6 +45,7 @@ class TaJian { @@ -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 { @@ -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' });

Loading…
Cancel
Save