From 810578b24bf174221c6dd59a6e30bb74d378f635 Mon Sep 17 00:00:00 2001 From: 42 <37006258+MirrorCY@users.noreply.github.com> Date: Sat, 2 Mar 2024 21:46:27 +0800 Subject: [PATCH] fix: fetch error due to header get failed --- package.json | 4 ++-- src/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5472e45..e721502 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "generate" ], "peerDependencies": { - "koishi": "^4.16.8" + "koishi": "^4.17.0-alpha.0" }, "devDependencies": { "@cordisjs/vitepress": "^3.2.6", @@ -73,7 +73,7 @@ "@types/libsodium-wrappers-sumo": "^0.7.8", "@types/node": "^20.11.19", "atsc": "^1.2.2", - "koishi": "^4.16.8", + "koishi": "^4.17.0", "sass": "^1.71.0", "typescript": "^5.3.3", "vitepress": "1.0.0-rc.40" diff --git a/src/index.ts b/src/index.ts index 74ee3a3..9f147d7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -441,13 +441,13 @@ export function apply(ctx: Context, config: Config) { } const imgRes = await ctx.http.axios(imgUrl, { responseType: 'arraybuffer' }) const b64 = Buffer.from(imgRes.data).toString('base64') - return forceDataPrefix(b64, imgRes.headers['content-type']) + return forceDataPrefix(b64, imgRes.headers.get('content-type')) } // event: newImage // id: 1 // data: - if (res.headers['content-type'] === 'application/x-zip-compressed') { + if (res.headers.get('content-type') === 'application/x-zip-compressed') { const buffer = Buffer.from(res.data, 'binary') // Ensure 'binary' encoding const zip = new AdmZip(buffer)