Convert content-type to lowercase for comparison (#114)

* Convert content-type to lowercase for comparison

* rust 1.78

* clippy priority

* upgrade dep
This commit is contained in:
Nutomic 2024-06-11 11:16:04 +02:00 committed by GitHub
parent 175b22006b
commit 6edbc06a78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View file

@ -1,5 +1,5 @@
variables:
- &rust_image "rust:1.77-bullseye"
- &rust_image "rust:1.78-bullseye"
steps:
cargo_fmt:

View file

@ -19,8 +19,8 @@ warnings = "deny"
deprecated = "deny"
[lints.clippy]
perf = "deny"
complexity = "deny"
perf = { level = "deny", priority = -1 }
complexity = { level = "deny", priority = -1 }
dbg_macro = "deny"
inefficient_to_string = "deny"
items-after-statements = "deny"
@ -61,7 +61,7 @@ bytes = "1.6.0"
futures-core = { version = "0.3.30", default-features = false }
pin-project-lite = "0.2.14"
activitystreams-kinds = "0.3.0"
regex = { version = "1.10.4", default-features = false, features = ["std", "unicode-case"] }
regex = { version = "1.10.5", default-features = false, features = ["std", "unicode"] }
tokio = { version = "1.37.0", features = [
"sync",
"rt",

View file

@ -65,9 +65,9 @@ pub async fn fetch_object_http<T: Clone, Kind: DeserializeOwned>(
let content_type = res
.content_type
.as_ref()
.and_then(|c| c.to_str().ok())
.and_then(|c| Some(c.to_str().ok()?.to_lowercase()))
.ok_or(Error::FetchInvalidContentType(res.url.clone()))?;
if !VALID_RESPONSE_CONTENT_TYPES.contains(&content_type) {
if !VALID_RESPONSE_CONTENT_TYPES.contains(&content_type.as_str()) {
return Err(Error::FetchInvalidContentType(res.url));
}