Skip to content

Added Trim to search query#1864

Merged
timbastin merged 4 commits intomainfrom
trim-trailing-whitespaces-dependency-risk
Apr 12, 2026
Merged

Added Trim to search query#1864
timbastin merged 4 commits intomainfrom
trim-trailing-whitespaces-dependency-risk

Conversation

@Dboy0ZDev
Copy link
Copy Markdown
Collaborator

@Dboy0ZDev Dboy0ZDev commented Apr 9, 2026

Added Trim to search query so trailing and leading whitespaces won't mess with the search

Issue: #1783

Copilot AI review requested due to automatic review settings April 9, 2026 14:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to make dependency vulnerability search more robust by normalizing the search query parameter so leading/trailing whitespace doesn’t affect query matching.

Changes:

  • Added strings import to support search normalization.
  • Trimmed the search query parameter before passing it to repository paging methods in DependencyVulnController.ListPaged.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 151 to 153
shared.GetPageInfo(ctx),
ctx.QueryParam("search"),
strings.Trim(ctx.QueryParam("search"), " "),
shared.GetFilterQuery(ctx),
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The trimmed search expression is duplicated in both branches (flat and non-flat). Consider reading search := strings.TrimSpace(ctx.QueryParam("search")) once before the if, and reusing it. Also, this controller’s other list endpoints still pass the raw ctx.QueryParam("search"), which makes search behavior inconsistent across routes.

Copilot uses AI. Check for mistakes.
@timbastin timbastin merged commit 9f94eda into main Apr 12, 2026
43 of 45 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.

3 participants