This commit is contained in:
@@ -29,9 +29,9 @@ pub async fn upload_to_s3(
|
||||
pub async fn check_file_exists(
|
||||
s3_client: &S3Client,
|
||||
bucket: &str,
|
||||
key: &str,
|
||||
file_key: &str,
|
||||
) -> Result<bool, actix_web::Error> {
|
||||
match s3_client.head_object().bucket(bucket).key(key).send().await {
|
||||
match s3_client.head_object().bucket(bucket).key(file_key).send().await {
|
||||
Ok(_) => Ok(true), // Файл найден
|
||||
Err(SdkError::ServiceError(service_error)) if service_error.err().is_not_found() => {
|
||||
Ok(false) // Файл не найден
|
||||
|
||||
Reference in New Issue
Block a user