Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in parsing of params[:page] #299

Closed
FlyboyArt opened this issue Mar 11, 2013 · 1 comment
Closed

Bug in parsing of params[:page] #299

FlyboyArt opened this issue Mar 11, 2013 · 1 comment

Comments

@FlyboyArt
Copy link

I just had a spammer send a route to me that was passed through to will_paginate and it caused an uncaught exception. The route was /page/wp_admin and WP tried to convert the 'wp_admin' to an integer and failed.

I put a pre_flioght chunk of code in my controller to catch and correct this but perhaps it would be better to catch this in WP. Here's the code I have in a :before_filter...

params.delete :page unless params[:page].is_a?(Integer)
@mislav
Copy link
Owner

mislav commented Mar 11, 2013

It's not a bug, it's a feature. Invalid page parameters in your app should trigger WillPaginate::InvalidPage exceptions. If you don't want to be aware of these exceptions, you can choose to silence them or work around them (as you did).

See #271

@mislav mislav closed this as completed Mar 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants