From 53b0b95554f75dd87640e905330dccef9fc2e7c0 Mon Sep 17 00:00:00 2001 From: minish Date: Thu, 2 Feb 2023 18:05:30 -0500 Subject: [PATCH] small tweaks --- src/engine.rs | 2 +- src/new.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) 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;