parent
cdd743ac8f
commit
6c2245ec98
|
@ -156,8 +156,26 @@ pub async fn proxy_handler(
|
|||
Ok(None) => {
|
||||
warn!("No stored path found in DB for: {}", filekey);
|
||||
let ct_parts = content_type.split("/").collect::<Vec<&str>>();
|
||||
let filepath = format!("production/{}/{}.{}", ct_parts[0], base_filename, ext);
|
||||
warn!("Looking up file with path: {} in bucket: {}", filepath, state.bucket);
|
||||
|
||||
// Создаем два варианта пути - с оригинальным расширением и с нижним регистром
|
||||
let filepath_lower = format!("production/{}/{}.{}", ct_parts[0], base_filename, ext);
|
||||
let filepath_orig = format!("production/{}/{}.{}", ct_parts[0], base_filename, extension);
|
||||
|
||||
warn!("Looking up files with paths: {} or {} in bucket: {}",
|
||||
filepath_lower, filepath_orig, state.bucket);
|
||||
|
||||
// Проверяем существование файла с обоими вариантами расширения
|
||||
let exists_in_aws_lower = check_file_exists(&state.aws_client, &state.bucket, &filepath_lower).await?;
|
||||
let exists_in_aws_orig = check_file_exists(&state.aws_client, &state.bucket, &filepath_orig).await?;
|
||||
|
||||
let filepath = if exists_in_aws_orig {
|
||||
filepath_orig
|
||||
} else if exists_in_aws_lower {
|
||||
filepath_lower
|
||||
} else {
|
||||
// Если файл не найден ни с одним из расширений, используем нижний регистр по умолчанию
|
||||
filepath_lower
|
||||
};
|
||||
|
||||
let exists_in_storj = check_file_exists(&state.storj_client, &state.bucket, &filepath).await?;
|
||||
warn!("Checking existence in Storj: {}", exists_in_storj);
|
||||
|
|
Loading…
Reference in New Issue
Block a user