Skip to content

Commit

Permalink
fix: ENOENT caused by function fileToBase64()
Browse files Browse the repository at this point in the history
  • Loading branch information
lava081 committed Aug 10, 2024
1 parent 5e69014 commit 5cafba1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/adapter/onebot/11/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function fileToBase64 (file: string, bot: AdapterOneBot11): string {
if (!bot || !file.startsWith('file://') || !bot.adapter.connect) return file
const list = ['127.0.0.1', 'localhost']
const url = new URL(bot.adapter.connect)
return list.includes(url.hostname) ? `base64://${fs.readFileSync(file).toString('base64')}` : file
return list.includes(url.hostname) ? `base64://${fs.readFileSync(file.replace(/^file:\/\//, '')).toString('base64')}` : file
}

/**
Expand Down

0 comments on commit 5cafba1

Please sign in to comment.