mirror of
https://github.com/koishijs/novelai-bot
synced 2025-01-07 07:06:54 +08:00
fix: fetch error due to header get failed (#239)
Co-authored-by: 42 <37006258+MirrorCY@users.noreply.github.com>
This commit is contained in:
parent
685e50f450
commit
6d8d634624
@ -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"
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user