-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Git Repo URL telemetry link fix: only Https #5202
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
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to c4c8a82. Security Overview
Detected Code ChangesThe diff is too large to display a summary of code changes. Reply to this PR with |
- Remove duplicate JSDoc comment from convertGitUrlToHttps function - Add test case to verify getGitRepositoryInfo converts SSH URLs to HTTPS format
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* https parsing in URL sanatizing for git repo * fix: remove duplicate JSDoc and add SSH to HTTPS conversion test - Remove duplicate JSDoc comment from convertGitUrlToHttps function - Add test case to verify getGitRepositoryInfo converts SSH URLs to HTTPS format --------- Co-authored-by: Daniel Riccio <[email protected]>
* https parsing in URL sanatizing for git repo * fix: remove duplicate JSDoc and add SSH to HTTPS conversion test - Remove duplicate JSDoc comment from convertGitUrlToHttps function - Add test case to verify getGitRepositoryInfo converts SSH URLs to HTTPS format --------- Co-authored-by: Daniel Riccio <[email protected]>
I've implemented a solution to convert git repository URLs to HTTPS format in telemetry. Here's a summary of the changes made:
Added a new convertGitUrlToHttps function in src/utils/git.ts that:
Leaves HTTPS URLs unchanged
Converts SSH URLs (like [email protected]:user/repo.git) to HTTPS format (https://github.com/user/repo.git)
Converts SSH URLs with ssh:// prefix to HTTPS format
Handles invalid URLs gracefully
Modified the getGitRepositoryInfo function to use this new function, converting repository URLs to HTTPS format before storing them in telemetry.
Added comprehensive tests for the new functionality.
These changes ensure that repository URLs in telemetry will work correctly regardless of whether they're in git or HTTPS format. The implementation maintains backward compatibility while adding the new conversion functionality.
If you'd like to test this implementation, you'll need to switch back to "Code" mode to run the tests. The tests should verify that:
HTTPS URLs remain unchanged
SSH URLs are properly converted to HTTPS format
The repository information extraction still works correctly
This solution addresses the issue you mentioned where git version URLs don't work in telemetry by automatically converting them to HTTPS format.
Important
Adds
convertGitUrlToHttps()to convert SSH URLs to HTTPS in telemetry, with tests for URL conversion.convertGitUrlToHttps()ingit.tsto convert SSH URLs to HTTPS, leaving HTTPS URLs unchanged.getGitRepositoryInfo()ingit.tsto useconvertGitUrlToHttps()for telemetry.convertGitUrlToHttps()ingit.spec.tsto verify URL conversion.getGitRepositoryInfo()ingit.spec.tsto check URL conversion to HTTPS.This description was created by
for c4c8a82. You can customize this summary. It will automatically update as commits are pushed.