fixes for archon: make mount point an owned String, fix downloader downloading to correct path, fix generated function name
This commit is contained in:
parent
4bddfaa0fa
commit
e4fe6ff37f
@ -78,7 +78,7 @@ impl ResourcesGenerator {
|
||||
|
||||
if let Some(ref mount_at) = resource.mount_at {
|
||||
let mut function_name = String::from("route");
|
||||
function_name.push_str(&mount_at.endpoint.replace("/", "_").replace(".", "_"));
|
||||
function_name.push_str(&mount_at.endpoint.replace("/", "_").replace(".", "_").replace("-", "_"));
|
||||
routes.push_str(&format!(
|
||||
"#[get(\"{}\")]\nfn {}() -> Content<&'static {}> {{\n\tContent(ContentType::{}, {})\n}}\n\n",
|
||||
mount_at.endpoint,
|
||||
@ -137,7 +137,7 @@ pub struct Resource {
|
||||
}
|
||||
|
||||
pub struct ResourceMount {
|
||||
pub endpoint: &'static str,
|
||||
pub endpoint: String,
|
||||
pub content_type: &'static str
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ impl Downloader {
|
||||
create_dir_all(self.cache.as_path()).expect("failed to create cache directory");
|
||||
}
|
||||
|
||||
let filename = url.get((url.rfind('/').expect("not a valid url")..)).expect("failed to parse filename");
|
||||
let filename = url.get((url.rfind('/').expect("not a valid url") + 1..)).expect("failed to parse filename");
|
||||
let mut out_path = self.cache.clone();
|
||||
out_path.push(filename);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user