Support SSH URLs with port numbers and improve validation#20
Merged
Conversation
The main changes are: - Update SSH URL regex to handle URLs with port numbers (e.g. ssh://user@host:port/path) - Add support for ~ character in valid repo path pattern - Improve URL format detection efficiency by using string prefix checks - Fix regex group handling for SSH URLs with optional port number - Add test cases for alternative SSH URL formats The commit focuses on improving SSH URL handling while maintaining security validation.
There was a problem hiding this comment.
Pull Request Overview
Enhances SSH URL parsing to support port numbers and improves repository URL validation. The changes modernize URL format detection and add comprehensive test coverage for different SSH URL formats.
- Updated SSH URL regex to handle port numbers in
ssh://user@host:port/pathformat - Added support for tilde character in repository path validation
- Improved URL format detection using efficient string prefix checks
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| main.go | Updates SSH regex pattern to support port numbers, improves URL detection logic with prefix checks, and adjusts regex group handling |
| main_test.go | Adds test cases for URL detection function and includes test for domain with port numbers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
The main changes are:
The commit focuses on improving SSH URL handling while maintaining security validation.