diff --git a/src/engine.rs b/src/engine.rs index 557e102..15b27ee 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -273,7 +273,7 @@ impl Engine { let mut cache = self.cache.write().await; cache.insert(name, data.clone()); - info!(/* */"recached upload from disk!"); + info!("recached upload from disk!"); return Ok(ViewSuccess::FromCache(data)); } diff --git a/src/new.rs b/src/new.rs index 2f864c3..f953455 100644 --- a/src/new.rs +++ b/src/new.rs @@ -13,13 +13,6 @@ pub async fn new( Query(params): Query>, stream: BodyStream, ) -> Result { - 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"); // check upload key, if i need to @@ -27,6 +20,13 @@ pub async fn new( 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 path = engine.gen_path(&original_path).await;