small tweaks
This commit is contained in:
parent
08826148bb
commit
53b0b95554
|
@ -273,7 +273,7 @@ impl Engine {
|
||||||
let mut cache = self.cache.write().await;
|
let mut cache = self.cache.write().await;
|
||||||
cache.insert(name, data.clone());
|
cache.insert(name, data.clone());
|
||||||
|
|
||||||
info!(/* */"recached upload from disk!");
|
info!("recached upload from disk!");
|
||||||
|
|
||||||
return Ok(ViewSuccess::FromCache(data));
|
return Ok(ViewSuccess::FromCache(data));
|
||||||
}
|
}
|
||||||
|
|
14
src/new.rs
14
src/new.rs
|
@ -13,13 +13,6 @@ pub async fn new(
|
||||||
Query(params): Query<HashMap<String, String>>,
|
Query(params): Query<HashMap<String, String>>,
|
||||||
stream: BodyStream,
|
stream: BodyStream,
|
||||||
) -> Result<String, StatusCode> {
|
) -> Result<String, StatusCode> {
|
||||||
let original_name = params.get("name");
|
|
||||||
|
|
||||||
// the original file name wasn't given, so i can't work out what the extension should be
|
|
||||||
if original_name.is_none() {
|
|
||||||
return Err(StatusCode::BAD_REQUEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
let key = params.get("key");
|
let key = params.get("key");
|
||||||
|
|
||||||
// check upload key, if i need to
|
// check upload key, if i need to
|
||||||
|
@ -27,6 +20,13 @@ pub async fn new(
|
||||||
return Err(StatusCode::FORBIDDEN);
|
return Err(StatusCode::FORBIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let original_name = params.get("name");
|
||||||
|
|
||||||
|
// the original file name wasn't given, so i can't work out what the extension should be
|
||||||
|
if original_name.is_none() {
|
||||||
|
return Err(StatusCode::BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
let original_path = PathBuf::from(original_name.unwrap());
|
let original_path = PathBuf::from(original_name.unwrap());
|
||||||
|
|
||||||
let path = engine.gen_path(&original_path).await;
|
let path = engine.gen_path(&original_path).await;
|
||||||
|
|
Loading…
Reference in New Issue