-
-
Notifications
You must be signed in to change notification settings - Fork 373
Fix IndexOutOfRangeException in CreateFromGit and add support for new Azure DevOps Git link format #3070
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
base: main
Are you sure you want to change the base?
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
- Added validation to check array length before accessing elements - Returns null with warning log for invalid Git external link formats - Added comprehensive unit tests for valid and invalid link scenarios Co-authored-by: MrHinsh <5205575+MrHinsh@users.noreply.github.com>
Co-authored-by: MrHinsh <5205575+MrHinsh@users.noreply.github.com>
|
@copilot the original request also inlcued the new format. Can you update the code to suport the new format as well? |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://blue-river-093197403-3070.westeurope.5.azurestaticapps.net |
I'd be happy to add support for the new format. Could you provide an example of the new Git link format you're seeing? For reference, the current code expects the format:
Is the new format:
An example link from the discussion would help me implement the correct parsing logic.
I've added support for both the old and new Git link formats in commit e21a3a7. Supported formats:
The code now detects which format is being used based on the number of parts after splitting by Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Support both formats: - Old format: projectId%2frepoId%2fcommitId (3+ parts) - New format: repoId%2fcommitId (2 parts) Updated tests to validate new format and removed test expecting 2-part links to fail Co-authored-by: MrHinsh <5205575+MrHinsh@users.noreply.github.com>
|
@copilot as per the original issue: I've checked that some of the LinkedArtifactUri values of the Git links are not in the expected legacy format: but instead use the newer Azure DevOps format: Can you support both the old and new format? |
The new format uses forward slashes instead of %2f encoding:
- Legacy: vstfs:///Git/Commit/{projectId}%2f{repoId}%2f{commitId}
- New: vstfs:///Git/Commit/{projectName}/{repoName}/{commitId}
Key differences:
- New format uses / separator instead of %2f
- New format uses project/repo names instead of GUIDs
- Repo lookup is by name for new format, by ID for legacy
Updated tests to cover both formats correctly
Co-authored-by: MrHinsh <5205575+MrHinsh@users.noreply.github.com>
I've updated the implementation to support the actual new Azure DevOps format in commit 7fcf0ee. Both formats are now supported:
The code detects which format by checking for the presence of |
Description
Fixes #3069
The
TfsGitRepositoryInfo.CreateFromGitmethod crashes withIndexOutOfRangeExceptionwhen processing Git external links that don't contain the expected format. The method was accessing array elements without bounds checking.This PR fixes the crash and adds support for both the legacy format using
%2fencoding and the new Azure DevOps format using forward slashes.Changes:
nullwith warning log for malformed links instead of throwingvstfs:///Git/Commit/{projectId}%2f{repoId}%2f{commitId}(uses %2f encoding, GUIDs)vstfs:///Git/Commit/{projectName}/{repoName}/{commitId}(uses forward slashes, names)%2fin the URLThings to be aware of
"My message that contains {item} and {item2}", item, item2! Do not use$"My message that contains {item} and {item2}"to pass text into the log strings as this disables Serilog's ability to pass that data as telemetry to Application Insights and for log highlighting.Type of change
How Has This Been Tested?
Checklist:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.