Skip to content

Pagination unescapes unrelated parameters #113

Description

@dmolesUC

Following on to #112 -- it seems like the same code:

links[page_name] = original_url + CGI.unescape(
  original_params.to_query
)

is having the (maybe?) unintended consequence of unescaping previously escaped parameters. Say I have a Rails route returning JSON:API, with a request URL like so:

http://example.test/resources?filter[genre_form]=Advertising+cards

When I include JSONAPI::Pagination in my controller, I get this links block:

    "links": {
        "self":    "http://example.test/resources?filter[genre_form]=Advertising+cards",
        "current": "http://example.test/resources?filter[genre_form]=Advertising cards&page[number]=1"
    }

The page number has been appended, which is good; the +-encoded space in filter[genre_form]=Advertising+cards has been decoded, which seems sketchy.

As with #112, maybe I'm just missing something about the design intent here, but I'd expect the original query to stay intact, and just have the page params set.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions