cleanup-request-rs
Felix Ableitner 2023-10-11 11:57:37 +02:00
parent 3be2a55dd0
commit 44d8168b01
2 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,8 @@ async fn image_proxy(
Query(params): Query<ImageProxyParams>, Query(params): Query<ImageProxyParams>,
context: web::Data<LemmyContext>, context: web::Data<LemmyContext>,
) -> LemmyResult<HttpResponse> { ) -> LemmyResult<HttpResponse> {
// TODO: Check that url corresponds to a federated image so that this can't be abused as a proxy
// for arbitrary purposes.
let url = decode(&params.url)?.into_owned(); let url = decode(&params.url)?.into_owned();
let image_response = context.client().get(url).send().await?; let image_response = context.client().get(url).send().await?;

View File

@ -77,7 +77,7 @@ mod tests {
"![My linked image](https://lemmy-alpha/image.png \"image alt text\")", "![My linked image](https://lemmy-alpha/image.png \"image alt text\")",
"<p><img src=\"https://lemmy-alpha/image.png\" alt=\"My linked image\" title=\"image alt text\" /></p>\n" "<p><img src=\"https://lemmy-alpha/image.png\" alt=\"My linked image\" title=\"image alt text\" /></p>\n"
), ),
// Ensure any custom plugins are added to 'MARKDOWN_PARSER' implementation. // Ensure spoiler plugin is added
( (
"basic spoiler", "basic spoiler",
"::: spoiler click to see more\nhow spicy!\n:::\n", "::: spoiler click to see more\nhow spicy!\n:::\n",