minorfixes
All checks were successful
deploy / deploy (push) Successful in 59s

This commit is contained in:
Untone 2024-10-22 09:48:41 +03:00
parent a2a053c582
commit 74b1be650f

View File

@ -160,6 +160,7 @@ impl AppState {
.hset::<_, &str, &str, ()>(PATH_MAPPING_KEY, aws_filekey, storj_filekey) .hset::<_, &str, &str, ()>(PATH_MAPPING_KEY, aws_filekey, storj_filekey)
.await .await
.map_err(|_| ErrorInternalServerError("Failed to save path mapping in Redis"))?; .map_err(|_| ErrorInternalServerError("Failed to save path mapping in Redis"))?;
// println!("[ok] {}", storj_filekey);
Ok(()) Ok(())
} }
@ -188,8 +189,8 @@ impl AppState {
let parts: Vec<&str> = key.split('.').collect(); let parts: Vec<&str> = key.split('.').collect();
let storj_filekey = parts.first().and_then(|s| s.split('/').last()).unwrap_or(parts.first().unwrap()); let storj_filekey = parts.first().and_then(|s| s.split('/').last()).unwrap_or(parts.first().unwrap());
if storj_filekey.is_empty() { if storj_filekey.is_empty() && !storj_filekey.ends_with("/") {
eprint!("[ERROR] empty filename: {}", key); eprint!("[ERROR] empty filename: {}\n", key);
} else { } else {
// Проверяем, существует ли файл на Storj S3 // Проверяем, существует ли файл на Storj S3
match check_file_exists(&self.storj_client, &self.storj_bucket, &storj_filekey).await match check_file_exists(&self.storj_client, &self.storj_bucket, &storj_filekey).await
@ -201,11 +202,11 @@ impl AppState {
{ {
eprintln!("[ERROR] save {}: {:?}", key, e); eprintln!("[ERROR] save {}: {:?}", key, e);
} else { } else {
println!("{}", key); println!("[ok] {}", key);
} }
} }
Ok(true) => { Ok(true) => {
println!("Already exists in Storj: {}", storj_filekey); println!("[skip] {}", storj_filekey);
} }
Err(e) => { Err(e) => {
eprintln!( eprintln!(