Fix search bar IP validation when using ;maxDays parameter#5
Merged
Conversation
Co-authored-by: devnomadic <14085319+devnomadic@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix maxDays validation issue in search bar
Fix search bar IP validation when using ;maxDays parameter
Oct 14, 2025
Deploying albatross with
|
| Latest commit: |
bc11584
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1233489f.albatross-5kt.pages.dev |
| Branch Preview URL: | https://copilot-fix-search-bar-maxda.albatross-5kt.pages.dev |
🚀 PR Status Dashboard📊 Workflow Status✅ CI: success (view) 🌐 Preview EnvironmentsSPA Preview: https://copilot-fix-search-bar-maxdays-validation.albatross-5kt.pages.dev 📝 PR DetailsBranch: This comment is automatically updated by the PR Update workflow |
* Initial plan * Add copilot/* branch filter to CodeQL and CI workflows Co-authored-by: devnomadic <14085319+devnomadic@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: devnomadic <14085319+devnomadic@users.noreply.github.com>
devnomadic
approved these changes
Oct 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
The search bar was failing with "Error during search: dns_bad_ip_address" when users entered an IP address with the optional
;maxDaysparameter (e.g.,8.8.8.8;60). This prevented users from customizing the abuse report time range when searching cloud IP ranges.Root Cause
The
ValidateAndSearch()method inPages/Home.razorwas attempting to parse the raw user input directly withIPAddress.Parse()without first stripping the;maxDayssuffix. This caused the parser to fail since"8.8.8.8;60"is not a valid IP address format.While the
IsValidIPAddress()validation method correctly handled the semicolon separator, and theAbuseIPDBService.CheckIPAsync()method also properly parsed it, the cloud IP search functionality was missing this extraction step.Solution
Added IP address extraction logic in the
ValidateAndSearch()method to strip the;maxDayssuffix before parsing, matching the pattern already used elsewhere in the codebase:Testing
The fix has been verified to work with all documented input formats:
8.8.8.8- Standard IP lookup (30 days of abuse reports)8.8.8.8;60- Custom report age (60 days of history) - now works!2001:4860:4860::8888- IPv6 addresses supported2001:4860:4860::8888;90- IPv6 with custom maxDays - now works!Both the "Search" button (cloud IP range lookup) and "Check IP Reputation" button (AbuseIPDB lookup) now handle the
;maxDaysparameter correctly.Impact
This is a minimal, surgical fix that adds only 5 lines of code to resolve the issue without affecting any other functionality.
Fixes #[issue_number]
Original prompt
Fixes #4
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.