Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cp: Fix --from-oci-layout when using full reference #1507

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Sep 20, 2024

  1. cmd/cp: Fix --from-oci-layout when using full reference

    Copying an image from an OCI layout with a value like
    "foo/bar:latest" for "org.opencontainers.image.ref.name" was failing with:
    
    ```
    $ oras cp --from-oci-layout ./myimage:foo/bar:latest localhost:5000/foo:latest
    Error: invalid argument "./myimage:foo/bar:latest": failed to find path "./myimage:foo/bar:": stat /myimage:foo/bar: no such file or directory
    ```
    
    According to [0], foo/bar:latest if a valid value for
    "org.opencontainers.image.ref.name", so the command should work.
    
    This commit fixes that by using strings.Index() instead of strings.LastIndex().
    
    [0]: https://github.com/opencontainers/image-spec/blob/v1.1.0-rc5/annotations.md
    
    Signed-off-by: Mauricio Vásquez <[email protected]>
    mauriciovasquezbernal committed Sep 20, 2024
    Configuration menu
    Copy the full SHA
    2ebab51 View commit details
    Browse the repository at this point in the history