Skip to content

URIs.append eats trailing slashes when not at the path root #1

@dmolesUC

Description

@dmolesUC

Steps to reproduce:

puts BerkeleyLibrary::Util::URIs.append('https://example.test/', '?', 'foo=bar')
puts BerkeleyLibrary::Util::URIs.append('https://example.test/path/', '?', 'foo=bar')

Expected:

Both output URLs have a / before the ?, as:

https://example.test/?foo=bar
https://example.test/path/?foo=bar

Actual:

Second output URL is missing the /, as:

https://example.test/?foo=bar
https://example.test/path?foo=bar

Notes

This Golang issue comment notes that Go's path.Clean has this behavior of stripping the trailing slash (and that such behavior isn't desirable for URL paths); I wouldn't be surprised if we have the same behavior in our Paths.join and/or Paths.ensure_abs (as used in URIs::Appender.to_uri), since Paths was patterned after the Go package.

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