(ctx context.Context, info nugettype.ArtifactInfo)
| 284 | } |
| 285 | |
| 286 | func (r *proxy) GetPackageMetadata(ctx context.Context, |
| 287 | info nugettype.ArtifactInfo) (nugettype.RegistrationResponse, error) { |
| 288 | upstreamProxy, err := r.proxyStore.GetByRegistryIdentifier(ctx, info.ParentID, info.RegIdentifier) |
| 289 | if err != nil { |
| 290 | return &nugettype.RegistrationIndexResponse{}, err |
| 291 | } |
| 292 | |
| 293 | helper, err := NewRemoteRegistryHelper(ctx, r.spaceFinder, *upstreamProxy, r.service) |
| 294 | if err != nil { |
| 295 | return &nugettype.RegistrationIndexResponse{}, err |
| 296 | } |
| 297 | fileReader, err := helper.GetPackageMetadata(ctx, info.Image, info.ProxyEndpoint) |
| 298 | if err != nil { |
| 299 | return &nugettype.RegistrationIndexResponse{}, err |
| 300 | } |
| 301 | |
| 302 | packageURL := r.urlProvider.PackageURL(ctx, info.RootIdentifier+"/"+info.RegIdentifier, "nuget") |
| 303 | |
| 304 | if info.ProxyEndpoint != "" { |
| 305 | metadata, err2 := parseRegistrationIndexPageResponse(fileReader) |
| 306 | if err2 != nil { |
| 307 | //todo: add handling for registration leaf |
| 308 | return &nugettype.RegistrationIndexPageResponse{}, err |
| 309 | } |
| 310 | updateRegistrationIndexPageResponse(metadata, packageURL, info.Image) |
| 311 | return metadata, nil |
| 312 | } |
| 313 | metadata, err2 := parseRegistrationIndexResponse(fileReader) |
| 314 | if err2 != nil { |
| 315 | return &nugettype.RegistrationIndexResponse{}, err |
| 316 | } |
| 317 | updateRegistrationIndexResponse(metadata, packageURL, info.Image) |
| 318 | return metadata, nil |
| 319 | } |
| 320 | |
| 321 | func (r *proxy) ListPackageVersionV2(ctx context.Context, |
| 322 | info nugettype.ArtifactInfo) (*nugettype.FeedResponse, error) { |
nothing calls this directly
no test coverage detected