Skip to content

Commit

Permalink
Read repo.subPath as part of the baseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
nesmabadr committed Aug 13, 2024
1 parent a6107ab commit 6a3032e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/img/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func parseDescriptor(ctx *runtime.UnstructuredTypedObject, descriptor *compdesc.
if err != nil {
return nil, fmt.Errorf("error while decoding the repository context into an OCI registry: %w", err)
}

typedRepo, ok := repo.(*genericocireg.RepositorySpec)
if !ok {
return nil, common.ErrTypeAssert
Expand Down Expand Up @@ -142,11 +141,20 @@ func getOCIRef(
); found {
repoSubpath = string(ext)
}
baseURL := repo.UniformRepositorySpec().String()

baseURL := repo.Name()
if repo.SubPath != "" {
baseURL = fmt.Sprintf("%s/%s", repo.Name(), repo.SubPath)
}

layerRef.Repo = fmt.Sprintf("%s/%s", baseURL, repoSubpath)
layerRef.Name = descriptor.GetName()
case genericocireg.OCIRegistryDigestMapping:
layerRef.Repo = repo.Name() + "/"
baseURL := repo.Name()
if repo.SubPath != "" {
baseURL = fmt.Sprintf("%s/%s", repo.Name(), repo.SubPath)
}
layerRef.Repo = baseURL + "/"
layerRef.Name = sha256sum(descriptor.GetName())
default:
return nil, fmt.Errorf(
Expand Down

0 comments on commit 6a3032e

Please sign in to comment.