Skip to content

Url::make_relative strips leading / #772

@alecmocatta

Description

@alecmocatta
  • Note that this crate implements the URL Standard not RFC 1738 or RFC 3986

This is an arguably less-critical version of #766.

Leading slashes are also incorrectly stripped. For example, I would expect this to print "/bar":

use url::Url;

fn main() {
    let base = Url::parse("https://foo.com/").unwrap();
    let url = base.join("https://foo.com//bar").unwrap();
    println!("{}", base.make_relative(&url).unwrap());
    // actually prints "bar"
}

As it is, base.join("bar") obviously gives https://foo.com/bar which is a different url to https://foo.com//bar per the URL Standard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions