Skip to content

Incorrect query string encoding with custom params #30

Description

@jameslong

Hi, I encounter HTML validation errors on the pagination links when using custom params.

To repro:

# Controller/context
params = %{"search" => %{"name" => "computer"}}
{:ok, kerosene} = Repo.paginate(Product, params)

# Template
<%= paginate @conn, @kerosene %>

which generates pagination links with the following query string:

?_utf8=%E2%9C%93&page=1&search[name]=computer

And HTML validation errors on w3 as follows:

Bad value /products?_utf8=%E2%9C%93&page=1&search[name]=computer for attribute href on element a: Illegal character in query: [ is not allowed.

The solution is to URL encode the [``] characters. I'm not sure what the recommended functions are to do this though!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions