debugger: Fix panic at non-UTF-8 character in paths on Linux (#49103)

cui created

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A

Change summary

crates/project/src/debugger/breakpoint_store.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Detailed changes

crates/project/src/debugger/breakpoint_store.rs 🔗

@@ -316,7 +316,7 @@ impl BreakpointStore {
             for (path, breakpoint_set) in &self.breakpoints {
                 let _ = client.send(proto::BreakpointsForFile {
                     project_id: *project_id,
-                    path: path.to_str().map(ToOwned::to_owned).unwrap(),
+                    path: path.to_string_lossy().into_owned(),
                     breakpoints: breakpoint_set
                         .breakpoints
                         .iter()
@@ -553,7 +553,7 @@ impl BreakpointStore {
             {
                 cx.background_spawn(remote.upstream_client.request(proto::ToggleBreakpoint {
                     project_id: remote.upstream_project_id,
-                    path: abs_path.to_str().map(ToOwned::to_owned).unwrap(),
+                    path: abs_path.to_string_lossy().into_owned(),
                     breakpoint: Some(breakpoint),
                 }))
                 .detach();
@@ -577,7 +577,7 @@ impl BreakpointStore {
 
             let _ = client.send(proto::BreakpointsForFile {
                 project_id: *project_id,
-                path: abs_path.to_str().map(ToOwned::to_owned).unwrap(),
+                path: abs_path.to_string_lossy().into_owned(),
                 breakpoints,
             });
         }