Skip to content

Commit

Permalink
Rewrite media URLs to cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
xSke committed Feb 15, 2024
1 parent e0e9dee commit 1035243
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ impl Puller {
#[instrument(skip_all)]
pub async fn pull(&self, parsed_url: &ParsedUrl) -> Result<PullResult, PKAvatarError> {
let time_before = Instant::now();
let trimmed_url = trim_url_query(&parsed_url.full_url)?;
let mut trimmed_url = trim_url_query(&parsed_url.full_url)?;
if trimmed_url.host_str() == Some("media.discordapp.net") {
trimmed_url.set_host(Some("cdn.discordapp.com")).expect("set_host should not fail");
}
let response = self
.client
.get(trimmed_url.clone())
Expand Down

0 comments on commit 1035243

Please sign in to comment.