(ctx context.Context, info nugettype.ArtifactInfo)
| 319 | } |
| 320 | |
| 321 | func (r *proxy) ListPackageVersionV2(ctx context.Context, |
| 322 | info nugettype.ArtifactInfo) (*nugettype.FeedResponse, error) { |
| 323 | upstreamProxy, err := r.proxyStore.GetByRegistryIdentifier(ctx, info.ParentID, info.RegIdentifier) |
| 324 | if err != nil { |
| 325 | return &nugettype.FeedResponse{}, err |
| 326 | } |
| 327 | helper, err := NewRemoteRegistryHelper(ctx, r.spaceFinder, *upstreamProxy, r.service) |
| 328 | if err != nil { |
| 329 | return &nugettype.FeedResponse{}, err |
| 330 | } |
| 331 | fileReader, err := helper.ListPackageVersionV2(ctx, info.Image) |
| 332 | if err != nil { |
| 333 | return &nugettype.FeedResponse{}, err |
| 334 | } |
| 335 | var result nugettype.FeedResponse |
| 336 | if err = xml.NewDecoder(fileReader).Decode(&result); err != nil { |
| 337 | return &nugettype.FeedResponse{}, err |
| 338 | } |
| 339 | packageURL := r.urlProvider.PackageURL(ctx, info.RootIdentifier+"/"+info.RegIdentifier, "nuget") |
| 340 | result.Xmlns = "http://www.w3.org/2005/Atom" |
| 341 | result.XmlnsD = xmlnsDataServices |
| 342 | result.XmlnsM = xmlnsDataServicesMetadata |
| 343 | result.Base = packageURL |
| 344 | result.ID = "http://schemas.datacontract.org/2004/07/" |
| 345 | result.Updated = time.Now() |
| 346 | links := []nugettype.FeedEntryLink{ |
| 347 | {Rel: "self", Href: xml.CharData(packageURL)}, |
| 348 | } |
| 349 | result.Links = links |
| 350 | |
| 351 | for _, entry := range result.Entries { |
| 352 | re := regexp.MustCompile(`Version='([^']+)'`) |
| 353 | matches := re.FindStringSubmatch(entry.ID) |
| 354 | if len(matches) > 1 { |
| 355 | version := matches[1] |
| 356 | err = modifyContent(entry, packageURL, info.Image, version) |
| 357 | if err != nil { |
| 358 | return &nugettype.FeedResponse{}, fmt.Errorf("failed to modify content: %w", err) |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | return &result, nil |
| 364 | } |
| 365 | |
| 366 | func (r *proxy) GetPackageVersionMetadataV2(ctx context.Context, |
| 367 | info nugettype.ArtifactInfo) (*nugettype.FeedEntryResponse, error) { |
nothing calls this directly
no test coverage detected