Skip to content

Conversation

dsherret
Copy link
Contributor

@dsherret dsherret commented Feb 9, 2022

let from_path = url::Url:::parse("http://127.0.0.1:8080/file.txt").unwrap();
let to_path = url::Url:::parse("http://127.0.0.1:8080/test/file.txt").unwrap();
println!("{}", from_path.make_relative(&to_path).unwrap());

Expected: "test/file.txt"
Actual: "test"

Not sure if this expected is correct or if the solution is right, but it passes the tests.

@dsherret dsherret changed the title fix: make_relative was missing filename when filenames were equal in another directory fix: make_relative missing filename when filenames equal in both urls Feb 11, 2022
@jgraettinger
Copy link

We hit this bug too. The current behavior is incorrect, and this PR LGTM for fixing it. Can it be merged?

jgraettinger added a commit to estuary/flow that referenced this pull request Jun 10, 2022
…m bug

Copy and use a fixed version of make_relative to account for upstream
bug in the url crate.

Issue servo/rust-url#754
@jgraettinger
Copy link

/cc @valenting this is a verified fix for a still-present bug in Url::make_relative. Can it be merged? Thanks.

@valenting
Copy link
Collaborator

Thanks for the ping. This looks good to me.

@valenting valenting merged commit e12d76a into servo:master Jun 10, 2022
@dsherret dsherret deleted the make_relative_include_filename_other_directory branch June 10, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants