Skip to content

Commit 0e4661b

Browse files
committed
🐛 Fix: qiniu error msg can't show
1 parent b89cf1e commit 0e4661b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/plugins/uploader/qiniu.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const handle = async (ctx: IPicGo): Promise<IPicGo> => {
4545
const base64Image = img.base64Image || Buffer.from(img.buffer).toString('base64')
4646
const options = postOptions(qiniuOptions, img.fileName, getToken(qiniuOptions), base64Image)
4747
const res = await ctx.request(options)
48+
console.log(res)
4849
const body = JSON.parse(res)
4950
if (body?.key) {
5051
delete img.base64Image
@@ -66,7 +67,7 @@ const handle = async (ctx: IPicGo): Promise<IPicGo> => {
6667
if (err.message !== 'Upload failed') {
6768
// err.response maybe undefined
6869
if (err.response) {
69-
const error = JSON.parse(err.response.body || '{}')
70+
const error = err.response.body
7071
ctx.emit(IBuildInEvent.NOTIFICATION, {
7172
title: ctx.i18n.translate<ILocalesKey>('UPLOAD_FAILED'),
7273
body: error.error

0 commit comments

Comments
 (0)