From de85e51fac53d6e6a73c4e98d913b1996725dddf Mon Sep 17 00:00:00 2001 From: Nutomic Date: Tue, 5 Dec 2023 17:19:12 +0100 Subject: [PATCH] Dont set duplicate context for activities (#4233) --- crates/apub/src/http/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/apub/src/http/mod.rs b/crates/apub/src/http/mod.rs index 7c1d8529a..d3e925de4 100644 --- a/crates/apub/src/http/mod.rs +++ b/crates/apub/src/http/mod.rs @@ -96,6 +96,13 @@ pub(crate) async fn get_activity( if sensitive { Ok(HttpResponse::Forbidden().finish()) } else { - create_apub_response(&activity.data) + // Don't use create_apub_response() to avoid duplicate context (the activity stored in db + // already includes context). + let json = serde_json::to_string_pretty(&activity.data)?; + Ok( + HttpResponse::Ok() + .content_type(FEDERATION_CONTENT_TYPE) + .body(json), + ) } }