From 76783eabe4f4cd6c2720d8d987d6d18e5bdb01f0 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 11 Nov 2024 02:18:57 +0100 Subject: [PATCH] `nodeinfo`: Allow MIME type of `application/jrd+json` --- acrate-nodeinfo/src/lib.rs | 8 ++++++-- acrate-nodeinfo/tests/discover_test.rs | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/acrate-nodeinfo/src/lib.rs b/acrate-nodeinfo/src/lib.rs index a6a40b4..51e7b88 100644 --- a/acrate-nodeinfo/src/lib.rs +++ b/acrate-nodeinfo/src/lib.rs @@ -82,8 +82,12 @@ impl HostMetaDocument { let mime_type = extract_mime_from_content_type(content_type) .ok_or(ContentTypeInvalid)?; - log::trace!("Ensuring MIME type of `{mime_type}` is acceptable for JRD parsing..."); - if mime_type != "application/json" { + log::trace!("Ensuring MIME type is acceptable for JRD parsing..."); + if mime_type == "application/jrd+json" { + log::warn!("MIME type `{mime_type}` would not be acceptable for JRD parsing, but is temporarily allowed anyways due to widespread use.") + } + else if mime_type != "application/json" { + log::error!("MIME type `{mime_type}` is not acceptable for JRD parsing."); return Err(ContentTypeInvalid) } diff --git a/acrate-nodeinfo/tests/discover_test.rs b/acrate-nodeinfo/tests/discover_test.rs index a8775a5..553d722 100644 --- a/acrate-nodeinfo/tests/discover_test.rs +++ b/acrate-nodeinfo/tests/discover_test.rs @@ -62,10 +62,10 @@ test!(iceshrimpnet, "https://ice.frieren.quest"); test!(gotosocial, "https://alpha.polymaths.social"); -test!(bridgyfed, "https://fed.brid.gy", ignore = "Returns application/jrd+json"); +test!(bridgyfed, "https://fed.brid.gy"); test!(threads, "https://threads.net", ignore = "Not implemented on their end"); test!(snac, "https://ngoa.giao.loan", ignore = "Does not support host-meta"); -test!(hollo, "https://hollo.social", ignore = "Returns application/jrd+json, does not support host-meta"); +test!(hollo, "https://hollo.social", ignore = "Does not support host-meta");