feat(graph): keep the original file name in the message
OneDrive stores a same-named upload as "plan 1.pdf" so nothing is replaced, while the message still shows "plan.pdf". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -221,6 +221,7 @@ impl Graph {
221
221
return Err(Error::EmptyUpload);
222
222
}
223
223
let scope = Scope::graph(FILES_SCOPE);
224
let shown_name = file_name;
224
225
let file_name = self.free_name(destination, file_name).await?;
225
226
let file_name = file_name.as_str();
226
227
let session_url = match destination {
@@ -265,7 +266,9 @@ impl Graph {
265
266
Ok(answer) if matches!(answer.status, 200 | 201) => {
266
267
guard.disarm();
267
268
progress(100);
268
return finished_item(answer.body);
269
let mut uploaded = finished_item(answer.body)?;
270
uploaded.name = shown_name.to_owned();
271
return Ok(uploaded);
269
272
}
270
273
Ok(_) => {
271
274
failures = 0;
@@ -221,6 +221,7 @@ impl Graph {221
return Err(Error::EmptyUpload);221
return Err(Error::EmptyUpload);222
}222
}223
let scope = Scope::graph(FILES_SCOPE);223
let scope = Scope::graph(FILES_SCOPE);224
let shown_name = file_name;224
let file_name = self.free_name(destination, file_name).await?;225
let file_name = self.free_name(destination, file_name).await?;225
let file_name = file_name.as_str();226
let file_name = file_name.as_str();226
let session_url = match destination {227
let session_url = match destination {@@ -265,7 +266,9 @@ impl Graph {265
Ok(answer) if matches!(answer.status, 200 | 201) => {266
Ok(answer) if matches!(answer.status, 200 | 201) => {266
guard.disarm();267
guard.disarm();267
progress(100);268
progress(100);268
return finished_item(answer.body);269
let mut uploaded = finished_item(answer.body)?;270
uploaded.name = shown_name.to_owned();271
return Ok(uploaded);269
}272
}270
Ok(_) => {273
Ok(_) => {271
failures = 0;274
failures = 0;