Skip to content

net/url: JoinPath() drops trailing slashes #52074

@drigz

Description

@drigz

What version of Go are you using (go version)?

dev branch (playground)

Does this issue reproduce with the latest release?

No, url.JoinPath() is not in Go 1.18.

What operating system and processor architecture are you using (go env)?

dev branch (playground)

What did you do?

https://go.dev/play/p/xCJcVPN5pPh?v=gotip

func main() {
	fmt.Println(url.JoinPath("http://host/foo", "bar/"))
}

What did you expect to see?

The trailing slash should be preserved: http://host/foo/bar/

What did you see instead?

The trailing slash is lost: http://host/foo/bar

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions