From 1953c13f0160a4f06ceee2893ccda8f43beb18a9 Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 2 Oct 2024 19:44:23 +0300 Subject: [PATCH] notfound-fix3 --- src/handlers.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); // убираем расширение файла