From 2eab4fa267b970b7f8cdaa2df92d39da85c1394c Mon Sep 17 00:00:00 2001 From: Sander Saarend Date: Wed, 11 Sep 2024 17:11:25 +0300 Subject: [PATCH] Image proxy fixes (#4871) * Fix remote image urls * Remove unnecessary URL decode * Removing the proxy changes. --------- Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com> Co-authored-by: Dessalines --- Cargo.lock | 1 - crates/routes/Cargo.toml | 1 - crates/routes/src/images.rs | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b21dce35..a34496113 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3104,7 +3104,6 @@ dependencies = [ "tokio", "tracing", "url", - "urlencoding", ] [[package]] diff --git a/crates/routes/Cargo.toml b/crates/routes/Cargo.toml index a614ba42d..6d74f0aae 100644 --- a/crates/routes/Cargo.toml +++ b/crates/routes/Cargo.toml @@ -32,5 +32,4 @@ serde = { workspace = true } url = { workspace = true } tracing = { workspace = true } tokio = { workspace = true } -urlencoding = { workspace = true } rss = "2.0.8" diff --git a/crates/routes/src/images.rs b/crates/routes/src/images.rs index 10ffb57de..307d0ab9f 100644 --- a/crates/routes/src/images.rs +++ b/crates/routes/src/images.rs @@ -22,7 +22,6 @@ use reqwest_middleware::{ClientWithMiddleware, RequestBuilder}; use serde::Deserialize; use std::time::Duration; use url::Url; -use urlencoding::decode; pub fn config( cfg: &mut web::ServiceConfig, @@ -255,7 +254,7 @@ pub async fn image_proxy( client: web::Data, context: web::Data, ) -> LemmyResult { - let url = Url::parse(&decode(¶ms.url)?)?; + let url = Url::parse(¶ms.url)?; // Check that url corresponds to a federated image so that this can't be abused as a proxy // for arbitrary purposes.