This commit is contained in:
parent
f5ee1c75ee
commit
e9e0815af8
|
@ -1,4 +1,5 @@
|
|||
use actix_web::{error::ErrorInternalServerError, web, HttpRequest, HttpResponse, Result};
|
||||
use log::warn;
|
||||
|
||||
use crate::app_state::AppState;
|
||||
use crate::handlers::serve_file::serve_file;
|
||||
|
@ -16,6 +17,8 @@ pub async fn proxy_handler(
|
|||
false => requested_res.to_string(),
|
||||
};
|
||||
|
||||
warn!("normalized_path: {}", normalized_path);
|
||||
|
||||
// парсим GET запрос
|
||||
if let Some((base_filename, requested_width, extension)) = parse_image_request(&normalized_path)
|
||||
{
|
||||
|
@ -34,8 +37,11 @@ pub async fn proxy_handler(
|
|||
_ => return Err(ErrorInternalServerError("unsupported file format")),
|
||||
};
|
||||
|
||||
warn!("content_type: {}", content_type);
|
||||
|
||||
return match state.get_path(&filekey).await {
|
||||
Ok(Some(stored_path)) => {
|
||||
warn!("stored_path: {}", stored_path);
|
||||
// we have stored file path in storj
|
||||
if check_file_exists(&state.storj_client, &state.bucket, &stored_path).await? {
|
||||
if content_type.starts_with("image") {
|
||||
|
@ -91,6 +97,7 @@ pub async fn proxy_handler(
|
|||
return match load_file_from_s3(&state.aws_client, &state.bucket, &stored_path).await
|
||||
{
|
||||
Ok(filedata) => {
|
||||
warn!("download stored_path from aws: {:?}", stored_path);
|
||||
let _ = upload_to_s3(
|
||||
&state.storj_client,
|
||||
&state.bucket,
|
||||
|
|
Loading…
Reference in New Issue
Block a user