Skip to content

Commit 976793e

Browse files
committed
Make ACROPOLIS_OFFLINE_MIRROR reference file paths, not contents
1 parent 1962198 commit 976793e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

modules/genesis_bootstrapper/build.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ async fn fetch_bytes(client: &reqwest::Client, url: &str) -> Result<Vec<u8>> {
1515
if let Ok(path) = env::var("ACROPOLIS_OFFLINE_MIRROR") {
1616
if let Ok(file) = File::open(&path) {
1717
if let Ok(map) = from_reader::<_, HashMap<String, String>>(file) {
18-
if let Some(s) = map.get(url) {
19-
return Ok(s.as_bytes().to_vec());
18+
if let Some(path) = map.get(url) {
19+
if let Ok(bytes) = fs::read(&Path::new(path).to_path_buf()) {
20+
return Ok(bytes);
21+
}
2022
}
2123
}
2224
}

modules/parameters_state/build.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ fn fetch_text(url: &str) -> Result<String, Box<dyn std::error::Error>> {
1414
if let Ok(path) = env::var("ACROPOLIS_OFFLINE_MIRROR") {
1515
if !path.is_empty() {
1616
if let Ok(file) = File::open(path) {
17-
let map: HashMap<String, String> = from_reader(file)?;
18-
if let Some(s) = map.get(url) {
19-
return Ok(s.clone());
17+
if let Ok(map) = from_reader::<_, HashMap<String, String>>(file) {
18+
if let Some(path_str) = map.get(url) {
19+
if let Ok(s) = fs::read_to_string(&Path::new(path_str).to_path_buf()) {
20+
return Ok(s);
21+
}
22+
}
2023
}
2124
}
2225
}

0 commit comments

Comments
 (0)