element-hq / element-hq/synapse

GET `/profile/<USER_ID>/avatar_url` and `/profile/<USER_ID>/displayname` return 200 with for users lacking an displayname and avatar, contradicting the spec

Open
#13,137 0 comments 0 reactions 0 assignees View on GitHub
A-Spec-Compliance P4 S-Tolerable T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#13137](https://github.com/matrix-org/synapse/issues/13137).

---

https://spec.matrix.org/v1.3/client-server-api/#get_matrixclientv3profileuseridavatar_url

>

Responses


>
>
> Status | Description
> -- | --
> 200 | The avatar URL for this user.
> 404 | There is no avatar URL for this user or this user does not exist.

Synapse only returns 404 when the requested user doesn't exist.

https://github.com/matrix-org/synapse/blob/c99b511db950bff5129e717a225de78b95b9b5ad/synapse/rest/client/profile.py#L96-L119

(Note that the server-server API has [a different response shape](https://spec.matrix.org/v1.3/server-server-api/#get_matrixfederationv1queryprofile).)

Easy enough to fix, but needs some thought to see if clients will be affected. We could event alter the spec to match Synapse's implementation if that's what clients and other servers are expecting and doing.

Note that the /displayname endpoint exhibits similar behaviour and is also in violation of the spec.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.