diff options
Diffstat (limited to '')
-rw-r--r-- | src/auth.rs | 4 | ||||
-rw-r--r-- | src/listing.rs | 2 | ||||
-rw-r--r-- | src/renderer.rs | 17 |
3 files changed, 8 insertions, 15 deletions
diff --git a/src/auth.rs b/src/auth.rs index efdeefb..82b407c 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -90,10 +90,10 @@ fn handle_auth(req: &HttpRequest) -> Result<(), ContextualError> { Ok(cred) => match match_auth(&cred, required_auth) { true => { req.extensions_mut().insert(CurrentUser { - name: cred.username + name: cred.username, }); Ok(()) - }, + } false => Err(ContextualError::InvalidHttpCredentials), }, Err(_) => Err(ContextualError::RequireHttpCredentials), diff --git a/src/listing.rs b/src/listing.rs index c1c9597..20768f1 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -379,7 +379,7 @@ pub fn directory_listing( breadcrumbs, &encoded_dir, conf, - current_user + current_user, ) .into_string(), ), diff --git a/src/renderer.rs b/src/renderer.rs index b18ac07..45cb145 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -21,18 +21,16 @@ pub fn page( current_user: Option<&CurrentUser>, ) -> Markup { // If query_params.raw is true, we want render a minimal directory listing - if query_params.raw.is_some() && query_params.raw.unwrap() == true { + if query_params.raw.is_some() && query_params.raw.unwrap() { return raw(entries, is_root); } - + let upload_route = match conf.random_route { Some(ref random_route) => format!("/{}/upload", random_route), None => "/upload".to_string(), }; let (sort_method, sort_order) = (query_params.sort, query_params.order); - - - + let upload_action = build_upload_action(&upload_route, encoded_dir, sort_method, sort_order); let title_path = breadcrumbs @@ -40,8 +38,6 @@ pub fn page( .map(|el| el.name.clone()) .collect::<Vec<_>>() .join("/"); - - html! { (DOCTYPE) @@ -159,10 +155,7 @@ pub fn page( } /// Renders the file listing #[allow(clippy::too_many_arguments)] -pub fn raw( - entries: Vec<Entry>, - is_root: bool -) -> Markup { +pub fn raw(entries: Vec<Entry>, is_root: bool) -> Markup { html! { (DOCTYPE) html { @@ -594,7 +587,7 @@ pub fn render_error( p.footer { (version_footer()) } - + } } } |