1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-06-27 16:35:59 +00:00

style: fix code fmt

This commit is contained in:
AndSDev 2025-06-10 11:01:07 +03:00
parent efe774b3c1
commit b2a4e398d8
2 changed files with 26 additions and 8 deletions

View file

@ -246,11 +246,11 @@ impl From<IncompleteConfig> for Config {
endpoint, endpoint,
bucket, bucket,
region, region,
path,
key, key,
secret, secret,
duration, duration,
bucket_use_path, bucket_use_path,
path,
directory_structure, directory_structure,
} => { } => {
let path_style = if bucket_use_path { let path_style = if bucket_use_path {

View file

@ -11,7 +11,7 @@ use ruma::{
}; };
use rusty_s3::S3Action; use rusty_s3::S3Action;
use sha2::{digest::Output, Digest, Sha256}; use sha2::{digest::Output, Digest, Sha256};
use tracing::{error, info, warn}; use tracing::{error, info};
use crate::{ use crate::{
config::{DirectoryStructure, MediaBackendConfig}, config::{DirectoryStructure, MediaBackendConfig},
@ -643,8 +643,14 @@ impl Service {
)); ));
} }
if !resp.status().is_success() { if !resp.status().is_success() {
error!("Failed to get file with sha256 hash of \"{}\" from S3 bucket: {}", sha256_hex, resp.text().await?); error!(
return Err(Error::BadS3Response("Failed to get media file from S3 bucket")); "Failed to get file with sha256 hash of \"{}\" from S3 bucket: {}",
sha256_hex,
resp.text().await?
);
return Err(Error::BadS3Response(
"Failed to get media file from S3 bucket",
));
} }
resp.bytes().await?.to_vec() resp.bytes().await?.to_vec()
@ -702,8 +708,14 @@ pub async fn create_file(sha256_hex: &str, file: &[u8]) -> Result<()> {
let resp = client.put(url).body(file.to_vec()).send().await?; let resp = client.put(url).body(file.to_vec()).send().await?;
if !resp.status().is_success() { if !resp.status().is_success() {
error!("Failed to upload file with sha256 hash of \"{}\" to S3 bucket: {}", sha256_hex, resp.text().await?); error!(
return Err(Error::BadS3Response("Failed to upload media file to S3 bucket")); "Failed to upload file with sha256 hash of \"{}\" to S3 bucket: {}",
sha256_hex,
resp.text().await?
);
return Err(Error::BadS3Response(
"Failed to upload media file to S3 bucket",
));
} }
} }
} }
@ -795,8 +807,14 @@ async fn delete_file(sha256_hex: &str) -> Result<()> {
let resp = client.delete(url).send().await?; let resp = client.delete(url).send().await?;
if !resp.status().is_success() { if !resp.status().is_success() {
error!("Failed to delete file with sha256 hash of \"{}\" from S3 bucket: {}", sha256_hex, resp.text().await?); error!(
return Err(Error::BadS3Response("Failed to delete media file from S3 bucket")); "Failed to delete file with sha256 hash of \"{}\" from S3 bucket: {}",
sha256_hex,
resp.text().await?
);
return Err(Error::BadS3Response(
"Failed to delete media file from S3 bucket",
));
} }
} }
} }