Skip to content

Commit 4ab293d

Browse files
committed
fix: maintain profile id
1 parent e99c3ad commit 4ab293d

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/commands/profile.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ async fn run_import(args: ImportArgs) -> anyhow::Result<()> {
183183
}
184184

185185
// Check for existing profile
186-
if let Some(existing) = profile_store::read_profile(&args.name)? {
186+
let existing = profile_store::read_profile(&args.name)?;
187+
if let Some(ref existing) = existing {
187188
eprintln!(
188189
"Profile \"{}\" already exists (id: {}). Overwriting.",
189190
args.name, existing.profile_id
@@ -280,8 +281,18 @@ async fn run_import(args: ImportArgs) -> anyhow::Result<()> {
280281

281282
// Upload
282283
println!(" Uploading...");
283-
let profile_id =
284-
profile_porter::upload_profile_to_steel(result.zip_buffer, &api_key, &api_base).await?;
284+
let profile_id = if let Some(ref existing) = existing {
285+
profile_porter::update_profile_on_steel(
286+
&existing.profile_id,
287+
result.zip_buffer,
288+
&api_key,
289+
&api_base,
290+
)
291+
.await?;
292+
existing.profile_id.clone()
293+
} else {
294+
profile_porter::upload_profile_to_steel(result.zip_buffer, &api_key, &api_base).await?
295+
};
285296

286297
// Save metadata
287298
profile_store::write_profile(

0 commit comments

Comments
 (0)