check-both2

This commit is contained in:
Untone 2024-11-12 12:13:15 +03:00
parent 6c2245ec98
commit 8cba92529e

View File

@ -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) => {