From a174cf721f802e2ba9c2db36cf0ea7794eb3bc1d Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com> Date: Thu, 2 May 2024 19:12:08 -0400 Subject: [PATCH] Replace dependency on unmaintained encoding crate with dep on maintained encoding_rs crate --- crates/api_common/Cargo.toml | 4 ++-- crates/api_common/src/request.rs | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/api_common/Cargo.toml b/crates/api_common/Cargo.toml index 9b196c426..a2b757343 100644 --- a/crates/api_common/Cargo.toml +++ b/crates/api_common/Cargo.toml @@ -25,7 +25,7 @@ full = [ "lemmy_db_views_moderator/full", "lemmy_utils/full", "activitypub_federation", - "encoding", + "encoding_rs", "reqwest-middleware", "webpage", "ts-rs", @@ -69,7 +69,7 @@ mime = { version = "0.3.17", optional = true } webpage = { version = "1.6", default-features = false, features = [ "serde", ], optional = true } -encoding = { version = "0.2.33", optional = true } +encoding_rs = {version = "0.8.34", optional = true } jsonwebtoken = { version = "8.3.0", optional = true } # necessary for wasmt compilation getrandom = { version = "0.2.14", features = ["js"] } diff --git a/crates/api_common/src/request.rs b/crates/api_common/src/request.rs index abf99f670..3c07d0832 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_common/src/request.rs @@ -6,7 +6,7 @@ use crate::{ utils::{local_site_opt_to_sensitive, proxy_image_link, proxy_image_link_opt_apub}, }; use activitypub_federation::config::Data; -use encoding::{all::encodings, DecoderTrap}; +use encoding_rs::{Encoding, UTF_8}; use lemmy_db_schema::{ newtypes::DbUrl, source::{ @@ -160,11 +160,9 @@ fn extract_opengraph_data(html_bytes: &[u8], url: &Url) -> LemmyResult