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

GET /rooms/ROOM/state/TYPE and /rooms/ROOM/state/TYPE/STATE_KEY accept unspecced format query parameter #14185

Closed
DMRobertson opened this issue Oct 14, 2022 · 1 comment
Labels
A-Spec-Compliance places where synapse does not conform to the spec O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. X-Consult-Clients Need to investigate if this change breaks clients Z-Cleanup Things we want to get rid of, but aren't actively causing pain

Comments

@DMRobertson
Copy link
Contributor

Here:

@cancellable
async def on_GET(
self, request: SynapseRequest, room_id: str, event_type: str, state_key: str
) -> Tuple[int, JsonDict]:
requester = await self.auth.get_user_by_req(request, allow_guest=True)
format = parse_string(
request, "format", default="content", allowed_values=["content", "event"]
)
msg_handler = self.message_handler
data = await msg_handler.get_room_data(
requester=requester,
room_id=room_id,
event_type=event_type,
state_key=state_key,
)
if not data:
raise SynapseError(404, "Event not found.", errcode=Codes.NOT_FOUND)
if format == "event":
event = format_event_for_client_v2(data.get_dict())
return 200, event
elif format == "content":
return 200, data.get_dict()["content"]
# Format must be event or content, per the parse_string call above.
raise RuntimeError(f"Unknown format: {format:r}.")

Not mentioned in

@DMRobertson DMRobertson added A-Spec-Compliance places where synapse does not conform to the spec S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. O-Uncommon Most users are unlikely to come across this or unexpected workflow X-Consult-Clients Need to investigate if this change breaks clients Z-Cleanup Things we want to get rid of, but aren't actively causing pain labels Oct 14, 2022
@DMRobertson
Copy link
Contributor Author

Oh, it seems like we actually want to spec this? matrix-org/matrix-spec#1047. Never mind then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Spec-Compliance places where synapse does not conform to the spec O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. X-Consult-Clients Need to investigate if this change breaks clients Z-Cleanup Things we want to get rid of, but aren't actively causing pain
Projects
None yet
Development

No branches or pull requests

1 participant