diff --git a/src/cache/fs.rs b/src/cache/fs.rs index 31bf60a..220fbfc 100644 --- a/src/cache/fs.rs +++ b/src/cache/fs.rs @@ -106,8 +106,8 @@ pub(super) async fn read_file( // else, just directly read from file. if let Some(key) = ENCRYPTION_KEY.get() { let mut header_bytes = [0; HEADERBYTES]; - if file.read_exact(&mut header_bytes).await.is_err() { - warn!("Found file, but encrypted header was not found. Assuming corrupted!"); + if let Err(e) = file.read_exact(&mut header_bytes).await { + warn!("Found file but failed reading header: {}", e); return None; } @@ -158,6 +158,7 @@ pub(super) async fn read_file( parsed_metadata.map(|metadata| Ok((stream, maybe_header, metadata))) } else { + debug!("Reader was invalid, file is corrupt"); None } } diff --git a/src/routes.rs b/src/routes.rs index e1728c4..e13f252 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -12,7 +12,7 @@ use base64::DecodeError; use bytes::Bytes; use chrono::{DateTime, Utc}; use futures::{Stream, TryStreamExt}; -use log::{debug, error, info, warn}; +use log::{debug, error, info, trace, warn}; use once_cell::sync::Lazy; use prometheus::{Encoder, TextEncoder}; use reqwest::{Client, StatusCode}; @@ -347,7 +347,7 @@ fn construct_response( data: impl Stream> + Unpin + 'static, metadata: &ImageMetadata, ) -> ServerResponse { - debug!("Constructing response"); + trace!("Constructing response"); let mut resp = HttpResponse::Ok(); if let Some(content_type) = metadata.content_type {