minorfix5

This commit is contained in:
Untone 2024-10-22 13:16:45 +03:00
parent 90b0f0bc3a
commit cb12533110

View File

@ -12,12 +12,12 @@ pub async fn proxy_handler(
requested_res: web::Path<String>,
state: web::Data<AppState>,
) -> Result<HttpResponse, actix_web::Error> {
info!("req.path: {}", req.path());
info!("requested_path: {}", requested_res);
let requested_path = requested_res.replace("/webp", "");
let parts = requested_path.split('/').collect::<Vec<&str>>(); // Explicit type annotation
let filename = parts[parts.len()-1];
let requested_path = match state.get_path(&filename).await {
let stored_path = match state.get_path(&filename).await {
Ok(Some(path)) => path,
Ok(None) => {
warn!("wrong filename: {}", filename);
@ -28,13 +28,13 @@ pub async fn proxy_handler(
return Ok(HttpResponse::InternalServerError().finish());
}
};
info!("requested path: {}", requested_path);
info!("stored path: {}", stored_path);
// Проверяем, запрошена ли миниатюра
if let Some((base_filename, requested_width, extension)) =
parse_thumbnail_request(&requested_res)
{
info!("thumbnail requested: {} width: {}, ext: {}", base_filename, requested_width, extension);
info!("thumbnail requested: {} width: {} ext: {}", base_filename, requested_width, extension);
// Находим ближайший подходящий размер
let closest_width = find_closest_width(requested_width);