Skip to content

normalized_encode incorrectly unencodes %26 to & #424

@davidtaylorhq

Description

@davidtaylorhq

When a query parameter includes %26, normalized_encode replaces it with a literal &, which results in a different URI:

pry(main)> Addressable::URI.normalized_encode("https://example.com?foo=bar%26baz")
=> "https://example.com?foo=bar&baz"

The more comprehensive URI#normalize method works correctly:

pry(main)> Addressable::URI.parse("https://example.com?foo=bar%26baz").normalize.to_s
=> "https://example.com/?foo=bar%26baz"

This issue is possibly related to #366 and #386. However, both of those issues apply to URI#normalize, wheras this %26 issue only seems to apply to the normalized_encode method.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions