oras-go icon indicating copy to clipboard operation
oras-go copied to clipboard

improve the returned error of `oci.NewFromTar` when the passed-in path is not a tarfile

Open qweeah opened this issue 2 years ago • 0 comments

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:

  • If the length of the file is zero, a failed to open OCI layout file: oci-layout: file does not exist error will be returned
  • If the length of the file is not zero, an io.ErrUnexpectedEOF will be returned

As 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.

qweeah avatar Nov 07 '23 06:11 qweeah