feat(gitea): implement GetTaskURI for remote task resolution#2732
feat(gitea): implement GetTaskURI for remote task resolution#2732theakshaypant wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements the GetTaskURI method for the Gitea provider, enabling the retrieval of task files from Gitea and Forgejo URLs. It introduces a splitGiteaURL helper function to extract organization, repository, reference, and path information, supported by new unit tests. Review feedback highlights the need for more robust URL handling by using EscapedPath and PathUnescape to correctly process encoded characters like slashes and plus signs. Additionally, it is recommended to verify the Gitea client's initialization to prevent potential nil pointer panics.
| uriPath := pURL.Path | ||
| if pURL.RawPath != "" { | ||
| uriPath = pURL.RawPath | ||
| } |
There was a problem hiding this comment.
Using pURL.Path for splitting is problematic because it is already unescaped by url.Parse. If a path segment (such as a branch name or a directory) contains an encoded slash (%2F), pURL.Path will contain a literal /, causing strings.Split to break the segment incorrectly. Using pURL.EscapedPath() ensures you split only on the intended delimiters.
| uriPath := pURL.Path | |
| if pURL.RawPath != "" { | |
| uriPath = pURL.RawPath | |
| } | |
| uriPath := pURL.EscapedPath() |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2732 +/- ##
==========================================
+ Coverage 59.46% 59.48% +0.01%
==========================================
Files 209 209
Lines 20702 20757 +55
==========================================
+ Hits 12311 12347 +36
- Misses 7616 7628 +12
- Partials 775 782 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8c9bdc4 to
d4d6bb7
Compare
Enable Gitea/Forgejo provider to resolve remote taskRef URLs using the provider's authenticated API instead of returning "not supported". Supports branch, tag, and commit SHA URL formats. Signed-off-by: Akshay Pant <akpant@redhat.com> Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
d4d6bb7 to
070e110
Compare
📝 Description of the Change
Enable Gitea/Forgejo provider to resolve remote taskRef URLs using the provider's authenticated API instead of returning "not supported". Supports branch, tag, and commit SHA URL formats.
🔗 Linked GitHub Issue
N/A
🧪 Testing Strategy
🤖 AI Assistance
AI assistance can be used for various tasks, such as code generation,
documentation, or testing.
Please indicate whether you have used AI assistance
for this PR and provide details if applicable.
Important
Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Claude noreply@anthropic.com
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.