This commit is contained in:
parent
a2a053c582
commit
74b1be650f
|
@ -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!(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user