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 search query parameter validation #863

Merged
merged 4 commits into from
Apr 22, 2024
Merged

Fix search query parameter validation #863

merged 4 commits into from
Apr 22, 2024

Conversation

triphora
Copy link
Contributor

No description provided.

@@ -191,7 +191,7 @@ pub async fn search_for_project(

let offset: usize = info.offset.as_deref().unwrap_or("0").parse()?;
let index = info.index.as_deref().unwrap_or("relevance");
let limit = info.limit.as_deref().unwrap_or("10").parse()?;
let limit = info.limit.as_deref().unwrap_or("10").parse::<usize>()?.min(100);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be max instead of min?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, min returns the minimum of the two. If the inputs are 10 and 100, it returns 10. If the inputs are 400 and 100, it returns 100.

Copy link

@tizu69 tizu69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aight lgtm then

@Geometrically Geometrically merged commit 28b0d34 into master Apr 22, 2024
6 of 8 checks passed
@Geometrically Geometrically deleted the fix-validation branch April 22, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants