Fix files naming #24
|
@ -109,11 +109,22 @@ impl FileManager {
|
||||||
|
|
||||||
match kind {
|
match kind {
|
||||||
LookupKind::ByName => {
|
LookupKind::ByName => {
|
||||||
if (&file).name.is_none() {
|
if let Some(name) = file.name.clone() {
|
||||||
|
log::debug!("Using {} as a custom file name", name);
|
||||||
|
|||||||
|
return Ok(self.save_int(
|
||||||
|
&file,
|
||||||
|
format!(
|
||||||
|
"{}{}{}",
|
||||||
|
self.env.redis.prefix,
|
||||||
|
midfix,
|
||||||
blek
commented
i'd say that if we're not sticking with dry then there is no need for that i'd say that if we're not sticking with dry then there is no need for that `midfix` variable. could've just hardcoded the `-(name|hash)-` thing to make it more apparent
|
|||||||
|
name
|
||||||
|
)
|
||||||
|
)?)
|
||||||
|
} else {
|
||||||
return Err("Filename can't be None when LookupKind is ByName!".into())
|
return Err("Filename can't be None when LookupKind is ByName!".into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => ()
|
_ => log::debug!("No custom file name detected")
|
||||||
}
|
}
|
||||||
|
|
||||||
self.save_int(
|
self.save_int(
|
||||||
|
@ -122,10 +133,7 @@ impl FileManager {
|
||||||
"{}{}{}",
|
"{}{}{}",
|
||||||
self.env.redis.prefix,
|
self.env.redis.prefix,
|
||||||
midfix,
|
midfix,
|
||||||
match kind {
|
file.hash()
|
||||||
LookupKind::ByName => (&file).name.as_ref().unwrap().clone(),
|
|
||||||
LookupKind::ByHash => (&file).hash()
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
breaks dry? see line 130 as well. not quite sure if thats a bad thing