diff --git a/src/handlers/proxy.rs b/src/handlers/proxy.rs index eb2da85..0a8134c 100644 --- a/src/handlers/proxy.rs +++ b/src/handlers/proxy.rs @@ -65,7 +65,7 @@ pub async fn proxy_handler( warn!("Processing image file with width: {}", requested_width); if requested_width == 0 { warn!("Serving original file without resizing"); - return serve_file(&stored_path, &state, shout_id).await; + serve_file(&stored_path, &state, shout_id).await } else { let closest: u32 = find_closest_width(requested_width as u32); warn!("Calculated closest width: {} for requested: {}", closest, requested_width); @@ -76,7 +76,7 @@ pub async fn proxy_handler( match check_file_exists(&state.storj_client, &state.bucket, thumb_filename).await { Ok(true) => { warn!("serve existed thumb file: {}", thumb_filename); - return serve_file(thumb_filename, &state, shout_id).await; + serve_file(thumb_filename, &state, shout_id).await }, Ok(false) => { // Миниатюра не существует, возвращаем оригинал и запускаем генерацию миниатюры @@ -97,16 +97,18 @@ pub async fn proxy_handler( } }); - return Ok(original_file); + Ok(original_file) } Err(e) => { error!("ошибка при проверке существования миниатюры: {}", e); - return Err(ErrorInternalServerError("failed to load thumbnail")); + Err(ErrorInternalServerError("failed to load thumbnail")) } } } + } else { + warn!("File is not an image, proceeding with normal serving"); + serve_file(&stored_path, &state, shout_id).await } - warn!("File is not an image, proceeding with normal serving"); } else { warn!("Attempting to load from AWS - bucket: {}, path: {}", state.bucket, stored_path);