You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
--oci-layout-path accepts custom header flags that --oci-layout rejects #2298
--oci-layout rejects custom header flags, but --oci-layout-path (and --from-oci-layout-path / --to-oci-layout-path) accepts them and ignores them:
$ oras manifest fetch --oci-layout layout:v1 -H foo:bar
Error: custom header flags cannot be used on an OCI image layout target
$ oras manifest fetch v1 --oci-layout-path layout -H foo:bar
(no error, the header is not used)
In Target.Parse (cmd/oras/internal/option/target.go) the check is only in the case target.IsOCILayout: branch. The case target.Path != "": branch also sets the target type to oci-layout but has no such check.
I found this by reading the code and checked it with a unit test on Target.Parse (the e2e test for this error only covers --oci-layout), not by running the CLI.
What did you expect to happen?
The same error for both ways of selecting an OCI image layout target.
How can we reproduce it?
Pass a header flag together with --oci-layout-path, for example oras manifest fetch v1 --oci-layout-path layout -H foo:bar, or run the unit test in the linked PR.
Activity