-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Pagination / pager->links() double encodes links #1680
Comments
@InsiteFX Thanks for the response. I did do some research before posting and did come across that article and others similar to it. I feel like I have ran into this issue before years ago with a CI2 app... I've been doing web development for a long time. The issue I'm having now is I'm running this app in the Google Cloud App Engine Standard PHP72. I'm not sure what web server Google is serving from- I'm thinking NGINX... but they don't offer htaccess files and the such. Is there any way to decode the URL first using CI4 before appending the page parameter? I'm not sure if this is a CI4 bug but perhaps logic can be put in place in the code to prevent this from happening? |
If your form is using a GET try using a POST method from what I read it does not have that problem using a post only a get has the double encoding. |
@InsiteFX OK- but the whole point of pager->links() is to carry on the query parameters. That way the user can paginate through pages of results (filtered or not). |
I'm thinking of creating a CI4 Controller Filter to modify/clean-up the URI before it's passed on to controller. Maybe I can grab the get variables and loop through/decode/clean-up stuff and then it'll work. I'm just having trouble figuring out how to do that now :-/ |
@niteraven7 Is your code up to date? I feel like we've ran into this in the past and fixed it. |
@lonnieezell Yes, I'm using alpha4. |
@lonnieezell I was hoping you'd chime in. I can see this as somewhat of a grey area where it could be considered a web server issue or framework issue. I'm using the pager exactly as described in the documentation. I'm not doing anything funny. |
I think this is what you might be thinking of: |
It looks like you've decoded the values but not the parameters/keys... |
|
It looks like this works:
|
@niteraven7 I believe you are correct. Just pushed that change. Hopefully this will work for you. |
My app is showing some results/reviews on a page and I also have the ability to filter these results using various criteria. My filter parameters passed as an array and are form submitted with get that has a URL like:
/reviews?filter%5Bkeyword%5D=test&filter%5Bsubmit%5D=1
The pager->links() currently and incorrectly double encodes the [] and then appends page=1, 2, 3 etc. to the end:
/reviews?filter%255Bkeyword%255D=claim&filter%255Bsubmit%255D=1&page=2
Note the 255B and 255D are double encoded [ and ] and it's breaking the URL.
version: alpha4
Thanks!
-Kyle
The text was updated successfully, but these errors were encountered: