Skip to content

Commit

Permalink
🐛 Fix: qiniu error msg can't show
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Sep 2, 2022
1 parent b89cf1e commit 0e4661b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plugins/uploader/qiniu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const handle = async (ctx: IPicGo): Promise<IPicGo> => {
const base64Image = img.base64Image || Buffer.from(img.buffer).toString('base64')
const options = postOptions(qiniuOptions, img.fileName, getToken(qiniuOptions), base64Image)
const res = await ctx.request(options)
console.log(res)
const body = JSON.parse(res)
if (body?.key) {
delete img.base64Image
Expand All @@ -66,7 +67,7 @@ const handle = async (ctx: IPicGo): Promise<IPicGo> => {
if (err.message !== 'Upload failed') {
// err.response maybe undefined
if (err.response) {
const error = JSON.parse(err.response.body || '{}')
const error = err.response.body
ctx.emit(IBuildInEvent.NOTIFICATION, {
title: ctx.i18n.translate<ILocalesKey>('UPLOAD_FAILED'),
body: error.error
Expand Down

0 comments on commit 0e4661b

Please sign in to comment.