fix: remove backup for declared repository (CM-1305) - #4337
Conversation
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
PR SummaryLow Risk Overview The value is now Reviewed by Cursor Bugbot for commit e72c6a5. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Pull request overview
This PR updates the public package detail response to stop falling back to the raw, non-normalized declared_repository_url value when emitting provenance.repositoryMapping.declaredRepo, ensuring the field only returns a canonical repository URL or null.
Changes:
- Removed the API-level fallback to
pkg.declaredRepositoryUrlwhen computingprovenance.repositoryMapping.declaredRepo.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Removes the API-level fallback to
declared_repository_url(the raw, non-normalized registry value) in the public package detail response, soprovenance.repositoryMapping.declaredReponever emits a website URL, placeholder, or free-form string — only a canonical repository link ornull.Changes
backend/src/api/public/v1/packages/getPackage.ts:declaredRepois nowpkg.repoUrl ?? pkg.repositoryUrl ?? null(dropped the trailing?? pkg.declaredRepositoryUrl). Both/v1/packages/detailand/v1/akrites/packages/detailshare this handler, so the fix applies to both endpoints.declaredRepocan now benullin cases where it previously returned a raw, non-canonical value.Type of change
JIRA ticket
CM-1305