koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.37k stars 237 forks source link

Bug: 多余请求头导致拿不到头像 #1377

Open SaarChaffee opened 6 months ago

SaarChaffee commented 6 months ago

Describe the bug

控制台请求 kook 机器人头像时返回了403,但是我直接浏览器打开又是可以正常访问的。于是我在 Apifox 尝试直接访问这个链接,可以正常拿到头像。但是当我加上 Referer 为 selfUrl 的地址时,就出现了 403 了。

Steps to reproduce

image

image

Expected behavior

Screenshots

No response

Versions

System: OS: Linux 5.4 Alpine Linux CPU: (1) x64 Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz

Binaries: Node: 20.9.0 Yarn: 1.22.19

Koishi: Core: 4.17.2 Console: 5.25.8

Additional context

No response

shigma commented 6 months ago

emmmmm 我不知道这是否是 fetch 的限制,如果你手动给 headers 传一个 referrer null 会覆盖吗?

SaarChaffee commented 6 months ago

我只在适配器那里找到了 headers 的配置,试过传 '' 或者 null,并没有覆盖掉它。

DGCK81LNN commented 3 months ago

https://developer.mozilla.org/en-US/docs/Web/API/fetch#referrerPolicy ?

shigma commented 3 months ago

能请问一下使用 fetch 的是哪一个插件吗?