From 596f4a81a8361e051d401b31317e0faf57624414 Mon Sep 17 00:00:00 2001 From: "fish.yu" Date: Thu, 18 Apr 2024 00:43:06 +0800 Subject: [PATCH] fix: resolve image upload --- lib/download.js | 3 +-- lib/github.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/download.js b/lib/download.js index 4533852..56cfb97 100644 --- a/lib/download.js +++ b/lib/download.js @@ -134,9 +134,8 @@ class Downloader { if (format === 'lakeboard' && cover) { // 上传图片到github const content = await downloadImage(cover); - console.log('download image:', content); const imageName = crypto.randomUUID() + '.' + cover.split('.').pop(); - const imageUrl = `/_images/${imageName}`; + const imageUrl = `${repo_name}/_images/${imageName}`; await gh.writeFile(imageUrl, content) mdBody = `![${title}](https://github.com${imageUrl})` } diff --git a/lib/github.js b/lib/github.js index ba8eccd..4c98885 100644 --- a/lib/github.js +++ b/lib/github.js @@ -1,7 +1,7 @@ const { GH_TOKEN, GH_LOGIN, GH_REPO } = process.env; const GitHub = require('github-api'); function handler(res) { - const result = res.data; + const result = res.data || res; if (result) { result.status = false; result.code = res.status;