Skip to content

Commit

Permalink
add byte literal comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Oct 26, 2023
1 parent 566fb55 commit 0f0bb29
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/kitsune-core/src/activitypub/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,11 @@ impl Fetcher {
let content_type = response
.headers()
.get(CONTENT_TYPE)
.map(HeaderValue::to_str)
.transpose()?;
.map(HeaderValue::as_bytes);

if content_type
!= Some("application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"")
&& content_type != Some("application/activity+json")
!= Some(b"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"")
&& content_type != Some(b"application/activity+json")
{
return Err(ApiError::BadRequest.into());
}
Expand Down

0 comments on commit 0f0bb29

Please sign in to comment.