Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants