diff --git a/src/handlers.rs b/src/handlers.rs index 2582e63..df076db 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -127,7 +127,6 @@ pub async fn proxy_handler( ) -> Result { info!("proxy_handler вызван с путем: {}", path); - // весь запрошенный путь let requested_path = match state.get_path(&path).await { Ok(Some(path)) => path, Ok(None) => { @@ -142,7 +141,9 @@ pub async fn proxy_handler( info!("Запрошенный путь: {}", requested_path); // имя файла - let filename_with_extension = requested_path.split("/").last().unwrap(); + let filename_with_extension = requested_path.split("/").last().ok_or_else(|| { + actix_web::error::ErrorInternalServerError("Неверный формат пути") + })?; info!("Имя файла с расширением: {}", filename_with_extension); // убираем расширение файла