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

Fix pagination bug in donations route #53

Merged
merged 1 commit into from
May 13, 2024

Conversation

benjaminJohnson2204
Copy link
Contributor

This PR fixes a bug in the paging for the GET /donations route.

A prior PR (#52) fixing a SQL injection vulnerability changed the behavior of the pageNum query parameter. Previously, the numDonations query parameter was used as the page size, and the pageNum parameter was used to determine the offset by multiplying it with numDonations. That PR changed the behavior to use pageNum as the SQL offset directly, leading to incorrect behavior. For example, if you visit /donations?numDonations=5&pageNum=2, it gives you entries 2 through 6 in the table, when it should give you entries 5 through 9 (since page 1 should give you entries 0 through 4, that's how paging works).

This PR changes the behavior back to the original so that paging will work as expected again (while maintaining security against SQL injection).

@benjaminJohnson2204 benjaminJohnson2204 changed the title Fix paging bug in donations route Fix pagination bug in donations route May 11, 2024
@jrock-3 jrock-3 merged commit 5fd9274 into ctc-uci:dev May 13, 2024
0 of 3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants