Summary
I wanted to make an action and provide an audit log reason that contains a Unicode character (✰ to be exact). Since the header value cannot contain non-ISO-8859-1 characters (or, realistically, characters outside the US-ASCII charset), I provided a URL-encoded UTF-8 value to the X-Audit-Log-Reason header, expecting the API to decode it before storing. Instead, the value was stored as is. FYI, this works fine on Discord.Steps to reproduce
- Make the following API request:
POST /v1/guilds/{guild.id}/roles HTTP/1.1 Authorization: Bot {token} X-Audit-Log-Reason: %28example%29 %E2%9C%B0 Content-Type: application/json Host: api.fluxer.app Content-Length: 17 {"name": "repro"} - Look at the audit log in the client to see the issue. You can also verify the value of the "reason" field for the audit log entry in DevTools to see that the reason was not decoded before storing.
(example) ✰

2 comments
Comment by Rex
Comment by @Jackenmen
reasonfield in API responses remains URL-encoded. I'm not sure whether that's the expected behaviour, it doesn't seem ideal from the API user's perspective and it differs from how Discord does it. image608897919-3a891110-eeee-4f9e-82ee-518e5279eb5c.png
2545×946 | 457 kB