Custom status text keeps trailing spaces in the settings API

(#3592) Bug Won't fix api

Observed behaviour

The documentation currently says (https://docs.fluxer.app/http-api/users/#custom-status-object): Structure: text ?string The status text (1-128 characters), or null when none is set It does not say whether that text returned by e.g. GET /v1/users/@me/settings is sanitized or unsanitized.

Platform

Web

Evidence

Proposed change It would be great if there was a guarantee that it's the unsanitized text. I rely on this and I think there should be no problem guaranteeing this and not adding sanitization to it in the future. E.g. new wording: "The unsanitized status text (1-128 characters), or null when none is set".
  1. Rex changed the status from Under consideration to Needs triage

3 comments

Sign in with Fluxer to comment and vote.
Comment by Rex
RexSystem 1 vote
Status changed from Needs triage to Needs info
Moved to a bug report, since text returned by the API should never keep leading or trailing spaces. The API trims and normalizes custom_status.text before storing it, the same as other text input, and GET returns what was stored. We can't reproduce trailing spaces: sending your example text with three trailing spaces to PATCH /users/@me/settings stores and returns it without them. To look into it further, please add:
  • the exact request you sent (the method, URL and JSON body, with your token removed)
  • the raw text from the GET response, for example piped through xxd or od -c, so we can see which characters the trailing ones are
  • which client or tool set the status (the Fluxer app, your integration, or the gateway)
Don't rely on the text matching your input byte for byte. Comparing trimmed text is safe.
Comment by Rex
RexSystem 1 vote
Status changed from Needs info to Won't fix
Works as intended. A zero-width joiner is not whitespace, so trimming stops at it. Discord's API behaves the same way, and we keep that for API compatibility.
Comment by Jonas
Jonas OP1 vote
Request:
PATCH https://api.fluxer.app/v1/users/@me/settings
{
  "custom_status": {
    "text": "Listening to THE DOSE – Witchz   ‍"
  }
}
Response:
...
  "custom_status": {
    "text": "Listening to THE DOSE – Witchz   ‍",
    "emoji_name": null,
    "emoji_animated": false
  },
...
With other texts I can't reproduce this either and it's trimmed properly. Text with Unicode escape sequences: "Listening to THE DOSE \u2013 Witchz ‍"