Compare commits

..

No commits in common. "e84ddee2a437972fb4b27a055df8e84036f472a1" and "aae05764f5a8aad4790ebd9776face1b00f74589" have entirely different histories.

2 changed files with 8 additions and 15 deletions

View File

@ -109,22 +109,11 @@ impl FileManager {
match kind { match kind {
LookupKind::ByName => { LookupKind::ByName => {
if let Some(name) = file.name.clone() { if (&file).name.is_none() {
log::debug!("Using {} as a custom file name", name);
return Ok(self.save_int(
&file,
format!(
"{}{}{}",
self.env.redis.prefix,
midfix,
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(
@ -133,7 +122,10 @@ impl FileManager {
"{}{}{}", "{}{}{}",
self.env.redis.prefix, self.env.redis.prefix,
midfix, midfix,
file.hash() match kind {
LookupKind::ByName => (&file).name.as_ref().unwrap().clone(),
LookupKind::ByHash => (&file).hash()
}
) )
) )
} }

View File

@ -95,7 +95,7 @@ impl UploadFormData {
if val.is_checked() { if val.is_checked() {
let name = data.get("filename")?; let name = data.get("filename")?;
out.filename = Some(name.as_atr_or_none()?); out.filename = Some(name.as_atr_or_none()?);
out.lookup_kind = LookupKind::ByName out.lookup_kind = LookupKind::ByHash
} }
}, },
None => () None => ()
@ -107,6 +107,7 @@ impl UploadFormData {
if val.is_checked() { if val.is_checked() {
let pass = data.get("password")?; let pass = data.get("password")?;
out.password = Some(pass.as_atr_or_none()?); out.password = Some(pass.as_atr_or_none()?);
out.lookup_kind = LookupKind::ByName
} }
}, },
None => () None => ()