-
Notifications
You must be signed in to change notification settings - Fork 94
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
improve the returned error of oci.NewFromTar
when the passed-in path is not a tarfile
#640
Comments
Hello I would like to work on this issue. I have tried implementing the required code changes in the PR #793 as best I could interpret them. |
@ADorigi Thanks for your contribution. After discussing with @qweeah offline, this issue is no longer valid. The more user-friendly error messages should be handled in the CLI instead of in the A proper example of store, err := oci.NewFromTar(ctx, path)
if err != nil {
return fmt.Errorf("%s: invalid or corrupted oci-style tarball: %w", path, err)
} |
Thanks @ADorigi for the contribution. io.ErrUnexpectedEOF already implies corrupted(invalid) tar ball file. Also, we notice that |
When opening a folder as OCI image layout and there is no `oci-layout` file exists, the error would be > failed to open OCI layout file: oci-layout: file does not exist There is a duplicated space in the error string, because the `Op` field is missing in the returned `fs.PathError`. With fix in this PR, the return error would be > failed to open OCI layout file: open oci-layout: file does not exist Fixes #640 Signed-off-by: Billy Zha <jinzha1@microsoft.com>
oci.NewFromTar can be used to create a new read-only OCI store from a tarfile path. If the passed-in path doesn't point to a tarfile, currently(v2.3.1) below errors will be returned:
failed to open OCI layout file: oci-layout: file does not exist
error will be returnedAs a user of oras-go SDK, I would like this function to return a unified and exported error type. Also, the error should indicate that the passed-in path doesn't point to an expected tarfile.
The text was updated successfully, but these errors were encountered: