Skip to content

Commit 5e7e224

Browse files
committed
fix issue with cache not working if first url got a redirect
1 parent c714adf commit 5e7e224

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/core.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ pub fn create_monolithic_document(
313313
}
314314
}
315315

316-
let target_url = match target.as_str() {
316+
let mut target_url = match target.as_str() {
317317
target_str => match Url::parse(target_str) {
318318
Ok(target_url) => match target_url.scheme() {
319319
"data" | "file" | "http" | "https" => target_url,
@@ -362,7 +362,6 @@ pub fn create_monolithic_document(
362362

363363
let client: Client = init_client(options);
364364
let data: Vec<u8>;
365-
let mut base_url: Url = target_url.clone();
366365
let document_encoding: Option<String>;
367366

368367
// Retrieve target document
@@ -380,8 +379,9 @@ pub fn create_monolithic_document(
380379
return Ok((retrieved_data, None));
381380
}
382381

383-
if options.base_url.clone().unwrap_or_default().is_empty() {
384-
base_url = final_url;
382+
// If got redirected, set target_url to that
383+
if final_url != target_url {
384+
target_url = final_url.clone();
385385
}
386386

387387
data = retrieved_data;

0 commit comments

Comments
 (0)