Skip to content

Commit

Permalink
feat: change file name
Browse files Browse the repository at this point in the history
  • Loading branch information
fish.yu committed Apr 18, 2024
1 parent 8a423e5 commit dfc1e8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down Expand Up @@ -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}))`
}
Expand Down

0 comments on commit dfc1e8f

Please sign in to comment.