mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-29 21:01:03 +00:00
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 <tyhou13@gmx.com>
This commit is contained in:
parent
6840a5e367
commit
2eab4fa267
3 changed files with 1 additions and 4 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3104,7 +3104,6 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
"urlencoding",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -32,5 +32,4 @@ serde = { workspace = true }
|
||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
tokio = { workspace = true }
|
tokio = { workspace = true }
|
||||||
urlencoding = { workspace = true }
|
|
||||||
rss = "2.0.8"
|
rss = "2.0.8"
|
||||||
|
|
|
@ -22,7 +22,6 @@ use reqwest_middleware::{ClientWithMiddleware, RequestBuilder};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use urlencoding::decode;
|
|
||||||
|
|
||||||
pub fn config(
|
pub fn config(
|
||||||
cfg: &mut web::ServiceConfig,
|
cfg: &mut web::ServiceConfig,
|
||||||
|
@ -255,7 +254,7 @@ pub async fn image_proxy(
|
||||||
client: web::Data<ClientWithMiddleware>,
|
client: web::Data<ClientWithMiddleware>,
|
||||||
context: web::Data<LemmyContext>,
|
context: web::Data<LemmyContext>,
|
||||||
) -> LemmyResult<HttpResponse> {
|
) -> LemmyResult<HttpResponse> {
|
||||||
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
|
// Check that url corresponds to a federated image so that this can't be abused as a proxy
|
||||||
// for arbitrary purposes.
|
// for arbitrary purposes.
|
||||||
|
|
Loading…
Reference in a new issue