fix
This commit is contained in:
parent
5cbc7ef0d2
commit
e50d31479c
1 changed files with 11 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
use std::path::PathBuf;
|
use std::{io::Read, path::PathBuf};
|
||||||
|
|
||||||
use based::request::RequestContext;
|
use based::request::RequestContext;
|
||||||
use maud::html;
|
use maud::html;
|
||||||
|
@ -189,17 +189,23 @@ impl Document {
|
||||||
format!("index_{version}.html")
|
format!("index_{version}.html")
|
||||||
} else {
|
} else {
|
||||||
let versions = self.versions();
|
let versions = self.versions();
|
||||||
versions.first().cloned()?
|
let version = versions.first().cloned()?;
|
||||||
|
format!("index_{version}.html")
|
||||||
};
|
};
|
||||||
|
|
||||||
file_path = file_path.join(format!("index_{}.html", latest_version));
|
file_path = file_path.join(latest_version);
|
||||||
|
|
||||||
let content = std::fs::read_to_string(file_path).ok()?;
|
let mut buf = Vec::new();
|
||||||
|
std::fs::File::open(file_path)
|
||||||
|
.unwrap()
|
||||||
|
.read_to_end(&mut buf)
|
||||||
|
.unwrap();
|
||||||
|
let content = String::from_utf8_lossy(&buf);
|
||||||
|
|
||||||
if std::env::var("ROUTE_INTERNAL").unwrap_or("false".to_string()) == "true" {
|
if std::env::var("ROUTE_INTERNAL").unwrap_or("false".to_string()) == "true" {
|
||||||
Some(internalize_urls(&content))
|
Some(internalize_urls(&content))
|
||||||
} else {
|
} else {
|
||||||
Some(content)
|
Some(content.to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue