Skip to content

Commit

Permalink
Update cid.go
Browse files Browse the repository at this point in the history
Co-authored-by: Rod Vagg <[email protected]>
  • Loading branch information
gammazero and rvagg committed Apr 4, 2023
1 parent 166a3a6 commit 0981f85
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cid.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,8 @@ func CidFromReader(r io.Reader) (int, Cid, error) {
vers, err := varint.ReadUvarint(br)
if err != nil {
if err == io.EOF {
// No data; not an invalid CID.
// First-byte read in ReadUvarint errors with io.EOF, so reader has no data.
// Subsequent reads with an EOF will return io.ErrUnexpectedEOF and be wrapped here.
return 0, Undef, err
}
return len(br.dst), Undef, ErrInvalidCid{err}
Expand Down

0 comments on commit 0981f85

Please sign in to comment.