From 4c2bb5aae19dcb15e2bee3127d57de80b5068195 Mon Sep 17 00:00:00 2001 From: networkException Date: Fri, 17 Jul 2026 13:27:19 +0200 Subject: [PATCH] Clarify user `avatar_url`s to always use MXC URIs (#2422) Previously the spec would use a mix of `string`, `URI` and `MXC URI` for values of a user's `avatar_url` in different apis (like `m.room.member`, `m.presence`, CS profile endpoints). This clarification updates all occurances to be MXC URIs, prompted by https URIs `m.room.member#avatar_url` events in the wild. Signed-off-by: networkException --- changelogs/client_server/newsfragments/2422.clarification | 1 + data/api/client-server/definitions/public_rooms_chunk.yaml | 3 ++- data/api/client-server/rooms.yaml | 3 ++- data/api/client-server/search.yaml | 3 ++- data/api/client-server/users.yaml | 3 ++- data/api/server-server/query.yaml | 2 ++ data/event-schemas/schema/m.presence.yaml | 2 ++ data/event-schemas/schema/m.room.member.yaml | 3 ++- 8 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 changelogs/client_server/newsfragments/2422.clarification diff --git a/changelogs/client_server/newsfragments/2422.clarification b/changelogs/client_server/newsfragments/2422.clarification new file mode 100644 index 00000000..20a7fe0a --- /dev/null +++ b/changelogs/client_server/newsfragments/2422.clarification @@ -0,0 +1 @@ +Use MXC URI type for all user `avatar_url` fields. Contributed by @networkException. diff --git a/data/api/client-server/definitions/public_rooms_chunk.yaml b/data/api/client-server/definitions/public_rooms_chunk.yaml index 8521ed08..2153fc34 100644 --- a/data/api/client-server/definitions/public_rooms_chunk.yaml +++ b/data/api/client-server/definitions/public_rooms_chunk.yaml @@ -54,7 +54,8 @@ properties: example: true avatar_url: type: string - format: uri + format: mx-mxc-uri + pattern: "^mxc:\\/\\/" description: The URL for the room's avatar, if one is set. example: "mxc://example.org/abcdef" join_rule: diff --git a/data/api/client-server/rooms.yaml b/data/api/client-server/rooms.yaml index d4c080de..87991da5 100644 --- a/data/api/client-server/rooms.yaml +++ b/data/api/client-server/rooms.yaml @@ -340,7 +340,8 @@ paths: description: The display name of the user this object is representing. avatar_url: type: string - format: uri + format: mx-mxc-uri + pattern: "^mxc:\\/\\/" description: The avatar of the user this object is representing, as an [`mxc://` URI](/client-server-api/#matrix-content-mxc-uris). description: A map from user ID to a RoomMember object. diff --git a/data/api/client-server/search.yaml b/data/api/client-server/search.yaml index 587894ff..4b8f48e6 100644 --- a/data/api/client-server/search.yaml +++ b/data/api/client-server/search.yaml @@ -238,7 +238,8 @@ paths: title: Display name avatar_url: type: string - format: uri + format: mx-mxc-uri + pattern: "^mxc:\\/\\/" title: Avatar Url events_before: type: array diff --git a/data/api/client-server/users.yaml b/data/api/client-server/users.yaml index 79906820..2531678f 100644 --- a/data/api/client-server/users.yaml +++ b/data/api/client-server/users.yaml @@ -90,7 +90,8 @@ paths: description: The display name of the user, if one exists. avatar_url: type: string - format: uri + format: mx-mxc-uri + pattern: "^mxc:\\/\\/" example: mxc://bar.com/foo description: The avatar url, as an [`mxc://` URI](/client-server-api/#matrix-content-mxc-uris), diff --git a/data/api/server-server/query.yaml b/data/api/server-server/query.yaml index ddcc5866..41763734 100644 --- a/data/api/server-server/query.yaml +++ b/data/api/server-server/query.yaml @@ -172,6 +172,8 @@ paths: example: John Doe avatar_url: type: string + format: mx-mxc-uri + pattern: "^mxc:\\/\\/" description: |- The avatar URL for the user's avatar. MUST either be omitted or set to `null` if the user does not have an avatar set. diff --git a/data/event-schemas/schema/m.presence.yaml b/data/event-schemas/schema/m.presence.yaml index 417c6fcc..33c68e78 100644 --- a/data/event-schemas/schema/m.presence.yaml +++ b/data/event-schemas/schema/m.presence.yaml @@ -12,6 +12,8 @@ "properties": { "avatar_url": { "type": "string", + "format": "mx-mxc-uri", + "pattern": "^mxc:\\/\\/", "description": "The current avatar URL for this user, if any." }, "displayname": { diff --git a/data/event-schemas/schema/m.room.member.yaml b/data/event-schemas/schema/m.room.member.yaml index 260070f6..7be9c1c8 100644 --- a/data/event-schemas/schema/m.room.member.yaml +++ b/data/event-schemas/schema/m.room.member.yaml @@ -53,7 +53,8 @@ properties: avatar_url: description: 'The avatar URL for this user, if any.' type: string - format: uri + format: mx-mxc-uri + pattern: "^mxc:\\/\\/" displayname: description: 'The display name for this user, if any.' type: