Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(rust): Fix sync command file downloads

Manav Rathi699794226f64
diff --git a/rust/src/commands/account.rs b/rust/src/commands/account.rs
index cedad9f0b1..c00cbed3fa 100644
--- a/rust/src/commands/account.rs
+++ b/rust/src/commands/account.rs
@@ -123,6 +123,9 @@ async fn add_account(
return Ok(());
}
+ // Check if we're in non-interactive mode (password provided via CLI)
+ let is_non_interactive = password_arg.is_some();
+
// Get password (from arg or prompt)
let password = if let Some(password) = password_arg {
password
@@ -133,9 +136,12 @@ async fn add_account(
.map_err(|e| crate::models::error::Error::InvalidInput(e.to_string()))?
};
- // Get export directory (from arg or prompt)
+ // Get export directory (from arg or use default)
let export_dir = if let Some(dir) = export_dir_arg {
dir
+ } else if is_non_interactive {
+ // If password was provided via CLI (non-interactive mode), use default path
+ format!("./exports/{email}")
} else {
Input::new()
.with_prompt("Enter export directory path")
diff --git a/rust/src/sync/download.rs b/rust/src/sync/download.rs
index abd7a5eb96..09658a5a03 100644
--- a/rust/src/sync/download.rs
+++ b/rust/src/sync/download.rs
@@ -81,8 +81,9 @@ impl DownloadManager {
temp_file.sync_all().await?;
drop(temp_file);
- // Move to final destination
- fs::rename(&temp_path, destination).await?;
+ // Move to final destination (use copy + delete to work across filesystems)
+ fs::copy(&temp_path, destination).await?;
+ fs::remove_file(&temp_path).await?;
// TODO: Update storage with local path
// self.storage.sync().update_file_local_path(file.id, destination.to_str().unwrap())?;