Skip to content

Commit

Permalink
fix: resolve image upload
Browse files Browse the repository at this point in the history
  • Loading branch information
fish.yu committed Apr 17, 2024
1 parent 63b98c3 commit 596f4a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})`
}
Expand Down
2 changes: 1 addition & 1 deletion lib/github.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 596f4a8

Please sign in to comment.