diff --git a/apiserver/facades/client/application/application_get.go b/apiserver/facades/client/application/application_get.go index df65dedc7ad..1999c4f43aa 100644 --- a/apiserver/facades/client/application/application_get.go +++ b/apiserver/facades/client/application/application_get.go @@ -126,14 +126,21 @@ func (api *APIBase) getCharmID(ctx context.Context, charmURL string) (corecharm. return "", errors.Annotate(err, "parsing charm URL") } + charmSource, err := applicationcharm.ParseCharmSchema(charm.Schema(curl.Schema)) + if err != nil { + return "", errors.Trace(err) + } charmID, err := api.applicationService.GetCharmID(ctx, applicationcharm.GetCharmArgs{ Name: curl.Name, Revision: ptr(curl.Revision), + Source: charmSource, }) if errors.Is(err, applicationerrors.CharmNotFound) { return "", errors.NotFoundf("charm %q", charmURL) } else if errors.Is(err, applicationerrors.CharmNameNotValid) { return "", errors.NotValidf("charm %q", charmURL) + } else if errors.Is(err, applicationerrors.CharmSourceNotValid) { + return "", errors.NotValidf("charm %q", charmURL) } else if err != nil { return "", errors.Annotate(err, "getting charm id") }