Fix Git permalinks not being URL-escaped (#39895)

Closes #39875

Release Notes:

- Fixed "open/copy permalink to line" paths not being URL-escaped

Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Andrew Farkas
2025-10-09 18:33:05 +00:00
committed by GitHub
co-authored by Cole Miller
parent 2dfde55367
commit c24f365b69
12 changed files with 169 additions and 140 deletions
+10 -14
View File
@@ -969,8 +969,6 @@ impl GitStore {
get_permalink_in_rust_registry_src(provider_registry, file_path, selection)
.context("no permalink available")
});
// TODO remote case
};
let buffer_id = buffer.read(cx).remote_id();
@@ -999,15 +997,9 @@ impl GitStore {
parse_git_remote_url(provider_registry, &origin_url)
.context("parsing Git remote URL")?;
let path = repo_path.as_unix_str();
Ok(provider.build_permalink(
remote,
BuildPermalinkParams {
sha: &sha,
path,
selection: Some(selection),
},
BuildPermalinkParams::new(&sha, &repo_path, Some(selection)),
))
}
RepositoryState::Remote { project_id, client } => {
@@ -4913,11 +4905,15 @@ fn get_permalink_in_rust_registry_src(
let path = PathBuf::from(cargo_vcs_info.path_in_vcs).join(path.strip_prefix(dir).unwrap());
let permalink = provider.build_permalink(
remote,
BuildPermalinkParams {
sha: &cargo_vcs_info.git.sha1,
path: &path.to_string_lossy(),
selection: Some(selection),
},
BuildPermalinkParams::new(
&cargo_vcs_info.git.sha1,
&RepoPath(
RelPath::new(&path, PathStyle::local())
.context("invalid path")?
.into_arc(),
),
Some(selection),
),
);
Ok(permalink)
}