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 5042a3f commit 63b98c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions lib/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ const { GH_TOKEN, GH_LOGIN, GH_REPO } = process.env;
const GitHub = require('github-api');
function handler(res) {
const result = res.data;
result.status = false;
result.code = res.status;
console.error(result)
if (result) {
result.status = false;
result.code = res.status;
console.error(result)
} else {
console.error(res)
}

return result;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ exports.downloadImage = (src) => {
return new Promise((resolve, reject) => {
axios.get(src, { responseType: 'arraybuffer' }).then((res) => {
const base64 = Buffer.from(res.data, 'binary').toString('base64');
resolve(`data:image/png;base64,${base64}`)
resolve(base64)
}).catch((err) => {
reject(err);
})
Expand Down

0 comments on commit 63b98c3

Please sign in to comment.