From 8cba92529e4ecfde0768fce4b8060f7eb97be463 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 12 Nov 2024 12:13:15 +0300 Subject: [PATCH] check-both2 --- src/handlers/proxy.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/handlers/proxy.rs b/src/handlers/proxy.rs index 21411ec..2cf4b09 100644 --- a/src/handlers/proxy.rs +++ b/src/handlers/proxy.rs @@ -115,13 +115,26 @@ pub async fn proxy_handler( // Определяем тип медиа из content_type let media_type = content_type.split("/").next().unwrap_or("image"); - let aws_paths = vec![ + // Создаем варианты путей с обоими регистрами расширения + let paths_lower = vec![ stored_path.clone(), format!("production/{}", stored_path), format!("production/{}/{}", media_type, stored_path) ]; - for path in aws_paths { + // Создаем те же пути, но с оригинальным регистром расширения + let orig_ext = extension.as_str(); // оригинальное расширение + let orig_stored_path = format!("{}.{}", base_filename, orig_ext); + let paths_orig = vec![ + orig_stored_path.clone(), + format!("production/{}", orig_stored_path), + format!("production/{}/{}", media_type, orig_stored_path) + ]; + + // Объединяем все пути для проверки + let all_paths = paths_lower.into_iter().chain(paths_orig.into_iter()); + + for path in all_paths { warn!("Trying AWS path: {}", path); match load_file_from_s3(&state.aws_client, &state.bucket, &path).await { Ok(filedata) => {