Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

/displayname returns non-JSON body #8029

Closed
KitsuneRal opened this issue Aug 4, 2020 · 3 comments · Fixed by #8517
Closed

/displayname returns non-JSON body #8029

KitsuneRal opened this issue Aug 4, 2020 · 3 comments · Fixed by #8517
Labels
z-bug (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p3 (Deprecated Label)

Comments

@KitsuneRal
Copy link
Member

KitsuneRal commented Aug 4, 2020

Description

An attempt to call /profile/{}/displayname with an empty body results (rightfully) in a 400 error, with plain text "Unable to parse name" in the response. The expected error payload is something about (could also be M_NOT_JSON instead of M_BAD_JSON):

{
    "errcode": "M_BAD_JSON",
    "error": "Unable to parse name" 
}

Version information

  • Homeserver: matrix.org
@babolivier
Copy link
Contributor

babolivier commented Aug 4, 2020

@KitsuneRal What's the request you performed? (i.e. what's the HTTP method you used?)

Both PUT and GET on https://matrix-client.matrix.org/_matrix/client/r0/profile/{}/displayname give me

{
    "errcode": "M_INVALID_PARAM",
    "error":"Expected UserID string to start with '@'"
}

@babolivier
Copy link
Contributor

Oh looks like {} is a placeholder for the MXID here.
In which case I can reproduce.

@KitsuneRal
Copy link
Member Author

KitsuneRal commented Aug 4, 2020

Ok, I wasn't clear: {} in the endpoint path is just a shortcut for {userId}. The problem (which, embarrasingly, I can't reproduce either) is that with some empty JSON payload in the request body I end up with the plain-text body in the 400 response.

@erikjohnston erikjohnston added z-bug (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p3 (Deprecated Label) labels Aug 6, 2020
KitsuneRal added a commit to quotient-im/libQuotient that referenced this issue Aug 23, 2020
This is a temporary workaround for
matrix-org/synapse#8029 - note that
regenerating CS API code will lead to overwriting this. The proper fix
should be done in matrix-doc (see
https://github.com/matrix-org/matrix-doc/issues/2717).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-bug (Deprecated Label) Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p3 (Deprecated Label)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants