Skip to content

Commit

Permalink
ensure the url is properly url-encoded
Browse files Browse the repository at this point in the history
  • Loading branch information
shouya committed Jul 5, 2024
1 parent e076c96 commit 8b04078
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/server/image_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ impl Config {
Referer::ImageUrlDomain => "image_url_domain",
Referer::Transparent => "transparent",
Referer::TransparentDomain => "transparent_domain",
Referer::Fixed(s) => s,
Referer::Fixed(s) => &urlencoding::encode(s),
};
params.push(format!("referer={referer}"));
}
Expand All @@ -398,12 +398,13 @@ impl Config {
UserAgent::None => "none",
UserAgent::Transparent => "transparent",
UserAgent::RssFunnel => "rss_funnel",
UserAgent::Fixed(s) => s,
UserAgent::Fixed(s) => &urlencoding::encode(s),
};
params.push(format!("user_agent={user_agent}"));
}

if let Some(proxy) = &self.proxy {
let proxy = &urlencoding::encode(proxy);
params.push(format!("proxy={proxy}"));
}

Expand Down

0 comments on commit 8b04078

Please sign in to comment.