1
Fork 0

nodeinfo: Allow MIME type of application/jrd+json

This commit is contained in:
Steffo 2024-11-11 02:18:57 +01:00
parent a74ee45f6e
commit 76783eabe4
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 8 additions and 4 deletions

View file

@ -82,8 +82,12 @@ impl HostMetaDocument {
let mime_type = extract_mime_from_content_type(content_type) let mime_type = extract_mime_from_content_type(content_type)
.ok_or(ContentTypeInvalid)?; .ok_or(ContentTypeInvalid)?;
log::trace!("Ensuring MIME type of `{mime_type}` is acceptable for JRD parsing..."); log::trace!("Ensuring MIME type is acceptable for JRD parsing...");
if mime_type != "application/json" { 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) return Err(ContentTypeInvalid)
} }

View file

@ -62,10 +62,10 @@ test!(iceshrimpnet, "https://ice.frieren.quest");
test!(gotosocial, "https://alpha.polymaths.social"); 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!(threads, "https://threads.net", ignore = "Not implemented on their end");
test!(snac, "https://ngoa.giao.loan", ignore = "Does not support host-meta"); 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");