Skip to content

Poping a path segment removes slash separator #912

@dsherret

Description

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

Describe the bug

Given the following code:

fn pop_last_segment(mut url: Url) -> Url {
  if let Ok(mut segments) = url.path_segments_mut() {
    segments.pop();
  }
  url
}

I get the following input and output:

IN:  file:///bar/deno.json
OUT: file:///bar

I would have expected the following output instead with a trailing slash so that it remains a directory:

file:///bar/

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