Use portable paths for subdirectories in lock URLs (#8707)

## Summary

We're writing different URLs on Windows vs. Linux because the
subdirectory path is being serialized with a back vs. forward slash.
This commit is contained in:
Charlie Marsh 2024-10-30 15:37:40 -04:00 committed by GitHub
parent 4a5a79eed8
commit bed47d512a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 149 additions and 4 deletions

View file

@ -3152,9 +3152,15 @@ fn locked_git_url(git_dist: &GitSourceDist) -> Url {
url.set_query(None);
// Put the subdirectory in the query.
if let Some(subdirectory) = git_dist.subdirectory.as_deref().and_then(Path::to_str) {
if let Some(subdirectory) = git_dist
.subdirectory
.as_deref()
.map(PortablePath::from)
.as_ref()
.map(PortablePath::to_string)
{
url.query_pairs_mut()
.append_pair("subdirectory", subdirectory);
.append_pair("subdirectory", &subdirectory);
}
// Put the requested reference in the query.