From dfc1e8ffc23ef3c1e0ca05dce73c31306cbbbaef Mon Sep 17 00:00:00 2001 From: "fish.yu" Date: Thu, 18 Apr 2024 15:05:22 +0800 Subject: [PATCH] feat: change file name --- lib/download.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/download.js b/lib/download.js index c46e8a1..0eb322b 100644 --- a/lib/download.js +++ b/lib/download.js @@ -115,7 +115,7 @@ class Downloader { * @param {Object} post 文章详情 */ generatePost(post) { - const { lastGenerate, client, gh, repo_name } = this; + const { lastGenerate, client, gh, repo_name, repo_slug } = this; return async () => { if (!isPost(post)) { console.error(`invalid post: ${post}`); @@ -143,14 +143,14 @@ class Downloader { // https://cdn.nlark.com/yuque/0/2024/png/394019/1713409985862-2a651a60-380a-4227-852c-e81d193340c5.png#averageHue=%23f8f9fa&clientId=u7b4c5a0c-9e50-4&from=ui&id=u0437de00&originHeight=48&originWidth=48&originalType=binary&ratio=2&rotation=0&showTitle=false&size=1428&status=done&style=none&taskId=ufab6517c-e059-4e38-8cef-b2ddf4390f8&title= const pathname = new URL(src).pathname; const fileName = pathname.split('/').pop(); - const name = `${repo_name}_${slug}_image_${fileName}` + const name = `${repo_slug}_${slug}_image_${fileName}` const imageUrl = await this.uploadImageFromUrl(src, name); mdBody = mdBody.replace(src, imageUrl); } } // 处理脑图 if (format === 'lakeboard' && cover) { - const name = `${repo_name}_${slug}_lakeboard_cover` + const name = `${repo_slug}_${slug}_lakeboard_cover` const imageUrl = await this.uploadImageFromUrl(cover, name); mdBody = `![${title}](${imageUrl}))` }