Skip to content

Conversation

@jason-famedly
Copy link
Contributor

Media that is already restricted will cause the creation of a room avatar to fail, leading to a partial room.

Check before saving any room data that the room avatar will not cause this situation

This is basically a duplicate of the existing condition block inside of _send_events_for_new_room(), with the exception that the media restrictions are not collected for attachment

@jason-famedly jason-famedly changed the title fix: Avoid partial room creation due to errors in room avatars with respect to media restriction fix(MSC3911): Avoid partial room creation due to errors in room avatars with respect to media restriction Sep 17, 2025
@jason-famedly jason-famedly marked this pull request as ready for review September 17, 2025 13:29
@jason-famedly jason-famedly requested a review from a team as a code owner September 17, 2025 13:29
@jason-famedly jason-famedly force-pushed the jason/pre-sanitize-create-room-avatar branch from 1931253 to 4b4154f Compare September 17, 2025 13:33
@itsoyou
Copy link
Contributor

itsoyou commented Sep 17, 2025

hmm would it better if we have another restrictions type: profile_room_id or something like that?

@jason-famedly
Copy link
Contributor Author

Probably not? This just needs to make sure the room avatar isn't going to break room creation after part of it has already happened. Like for instance, if the requested room avatar is already attached to another room, then they messed up on the request somehow. Instead of having a partial room with only one person and no other events or state, this just aborts the whole process.

@jason-famedly
Copy link
Contributor Author

To be fair, the correct thing to do here would be to make the entire process of creating a room atomic. That is a lot of rearranging of existing code to "prevalidate" that all events will be valid before they are persisted. Then there is the situation where the persisting of the events can fail part way through.

It's a heavy lift, and way out of scope for this part of the project

Copy link
Member

@nico-famedly nico-famedly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, although we probably should dedup the code some more after we fixed all the bugs :)

@nico-famedly nico-famedly merged commit 3dda03a into msc3911 Sep 18, 2025
20 of 23 checks passed
@nico-famedly nico-famedly deleted the jason/pre-sanitize-create-room-avatar branch September 18, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants