Skip to content

Bug when parameters are empty string #51

Open
@synth

Description

@synth

When a parameter is included in a request but is a blank empty string, there is unexpected and buggy behavior.

  • When params[:page] == "", #to_i is called on it, which causes the page to default to 0. Normally, the first page is 1. This may be equivalent now, but in the future may cause unintended consequences.
  • When params[:per_page] == "", this causes the error: "comparison of Fixnum with String failed".

I propose that when a parameter is included but is empty string that more defined behavior occurs such as falling back to a default.

  • params[:page] should default to 1
  • params[:per_page] should default to route_setting(:per_page).

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