Skip to content

Commit

Permalink
Fix bug handling images with slashes in ref (#3211)
Browse files Browse the repository at this point in the history
Fix bug handling images with slashes

This commit fixes a bug when trying to list images with
    names in their reference. The github API expects everything
    after the org urls escaped, for exmaple:

     ghcr.io/org/name/with/slahes

    needs to be

     ghcr.io/org/name%2Fwith%2Fslahes

Signed-off-by: Adolfo García Veytia (puerco) <puerco@stacklok.com>
Co-authored-by: Don Browne <dmjb@users.noreply.github.com>
  • Loading branch information
puerco and dmjb committed May 1, 2024
1 parent 087ba6b commit 1337072
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/engine/ingester/artifact/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package artifact
import (
"context"
"fmt"
"net/url"
"sort"
"strings"
"time"
Expand Down Expand Up @@ -259,7 +260,10 @@ func getAndFilterArtifactVersions(
}

// Fetch all available versions of the artifact
upstreamVersions, err := ghCli.GetPackageVersions(ctx, artifact.Owner, artifact.GetTypeLower(), artifact.GetName())
artifactName := url.QueryEscape(artifact.GetName())
upstreamVersions, err := ghCli.GetPackageVersions(
ctx, artifact.Owner, artifact.GetTypeLower(), artifactName,
)
if err != nil {
return nil, fmt.Errorf("error retrieving artifact versions: %w", err)
}
Expand Down

0 comments on commit 1337072

Please sign in to comment.