parent
5b7d84de03
commit
bdda6b6341
|
@ -112,7 +112,14 @@ pub async fn proxy_handler(
|
|||
} else {
|
||||
warn!("Attempting to load from AWS - bucket: {}, path: {}", state.bucket, stored_path);
|
||||
|
||||
return match load_file_from_s3(&state.aws_client, &state.bucket, &stored_path).await {
|
||||
let aws_paths = vec![
|
||||
stored_path.clone(),
|
||||
format!("production/{}", stored_path)
|
||||
];
|
||||
|
||||
for path in aws_paths {
|
||||
warn!("Trying AWS path: {}", path);
|
||||
match load_file_from_s3(&state.aws_client, &state.bucket, &path).await {
|
||||
Ok(filedata) => {
|
||||
warn!("Successfully loaded file from AWS, size: {} bytes", filedata.len());
|
||||
warn!("Attempting to upload to Storj with key: {}", filekey);
|
||||
|
@ -129,13 +136,17 @@ pub async fn proxy_handler(
|
|||
warn!("Successfully uploaded to Storj: {}", filekey);
|
||||
}
|
||||
|
||||
Ok(HttpResponse::Ok().content_type(content_type).body(filedata))
|
||||
return Ok(HttpResponse::Ok().content_type(content_type).body(filedata));
|
||||
}
|
||||
Err(err) => {
|
||||
error!("Failed to load from AWS: {} - Full error: {:?}", stored_path, err);
|
||||
Err(ErrorInternalServerError(err))
|
||||
warn!("Failed to load from AWS path {}: {:?}", path, err);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
error!("Failed to load from any AWS path for: {}", stored_path);
|
||||
Err(ErrorInternalServerError("Failed to load file from AWS"))
|
||||
}
|
||||
}
|
||||
Ok(None) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user