Compare commits

..

No commits in common. "c0df04d7d5309e32348ceecc68eecd64c5e5cba4" and "b104af5e4cd5de06dfde3a397eae3adc1127f112" have entirely different histories.

2 changed files with 4 additions and 15 deletions

View File

@ -10,11 +10,6 @@ import (
var MAGIC_BYTES = []byte{0x26, 0x1f}
var (
ErrMissingEmptySize = errors.New("Missing or empty size")
ErrInvalidCIDMagic = errors.New("CID magic bytes missing or invalid")
)
type CID struct {
Hash [32]byte
Size uint64
@ -81,19 +76,13 @@ func maybeDecode(cid string) ([]byte, error) {
}
if bytes.Compare(data[0:len(MAGIC_BYTES)], MAGIC_BYTES) != 0 {
return nil, ErrInvalidCIDMagic
return nil, errors.New("CID magic bytes missing or invalid")
}
sizeBytes := data[len(MAGIC_BYTES)+32:]
if len(sizeBytes) == 0 {
return nil, ErrMissingEmptySize
}
size := binary.LittleEndian.Uint64(sizeBytes)
size := binary.LittleEndian.Uint64(data[len(MAGIC_BYTES)+32:])
if size == 0 {
return nil, ErrMissingEmptySize
return nil, errors.New("missing or empty size")
}
return data, nil

View File

@ -130,7 +130,7 @@ func (f *FilesController) GetStatusBy(cidString string) {
statusCode = "uploading"
break
case files.STATUS_NOT_FOUND:
statusCode = "not_found"
statusCode = "uploading"
break
}