docs
Some checks failed
CI / test (push) Failing after 4m0s
CI / lint (push) Failing after 4s
CI / deploy (push) Has been skipped

This commit is contained in:
2025-08-02 00:18:09 +03:00
parent adda2b30f9
commit ea92a376ed
32 changed files with 3360 additions and 280 deletions

View File

@@ -1,8 +1,8 @@
use actix_web::error::ErrorInternalServerError;
use aws_sdk_s3::{error::SdkError, primitives::ByteStream, Client as S3Client};
use infer::get;
use mime_guess::mime;
use std::str::FromStr;
use infer::get;
/// Загружает файл в S3 хранилище.
pub async fn upload_to_s3(
@@ -32,7 +32,13 @@ pub async fn check_file_exists(
bucket: &str,
filepath: &str,
) -> Result<bool, actix_web::Error> {
match s3_client.head_object().bucket(bucket).key(filepath).send().await {
match s3_client
.head_object()
.bucket(bucket)
.key(filepath)
.send()
.await
{
Ok(_) => Ok(true), // Файл найден
Err(SdkError::ServiceError(service_error)) if service_error.err().is_not_found() => {
Ok(false) // Файл не найден
@@ -117,6 +123,6 @@ pub fn get_extension_from_mime(mime_type: &str) -> Option<&str> {
"image/webp" => Some("webp"),
"image/heic" => Some("heic"),
"image/tiff" => Some("tiff"),
_ => None
_ => None,
}
}
}