mirror of
https://github.com/ipfs/kubo.git
synced 2025-10-26 02:45:48 +08:00
better error message from dagreader with bad protofbuf
This commit is contained in:
@ -3,6 +3,7 @@ package io
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ func (dr *DagReader) precalcNextBuf() error {
|
|||||||
pb := new(ftpb.Data)
|
pb := new(ftpb.Data)
|
||||||
err = proto.Unmarshal(nxt.Data, pb)
|
err = proto.Unmarshal(nxt.Data, pb)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("incorrectly formatted protobuf: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch pb.GetType() {
|
switch pb.GetType() {
|
||||||
|
|||||||
Reference in New Issue
Block a user