fix: need to use hashBytes and an optional type
This commit is contained in:
parent
a1f36df8b9
commit
f79a0dd448
|
@ -1657,6 +1657,7 @@ func (s *S5API) downloadFile(jc jape.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var hashBytes []byte
|
var hashBytes []byte
|
||||||
|
var typ types.CIDType
|
||||||
isProof := false
|
isProof := false
|
||||||
|
|
||||||
if strings.HasSuffix(cid, storage.PROOF_EXTENSION) {
|
if strings.HasSuffix(cid, storage.PROOF_EXTENSION) {
|
||||||
|
@ -1676,11 +1677,12 @@ func (s *S5API) downloadFile(jc jape.Context) {
|
||||||
hashBytes = hashDecoded.HashBytes()
|
hashBytes = hashDecoded.HashBytes()
|
||||||
} else {
|
} else {
|
||||||
hashBytes = cidDecoded.Hash.HashBytes()
|
hashBytes = cidDecoded.Hash.HashBytes()
|
||||||
|
typ = cidDecoded.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
file := s.newFile(FileParams{
|
file := s.newFile(FileParams{
|
||||||
Hash: cidDecoded.Hash.HashBytes(),
|
Hash: hashBytes,
|
||||||
Type: cidDecoded.Type,
|
Type: typ,
|
||||||
})
|
})
|
||||||
|
|
||||||
if !file.Exists() {
|
if !file.Exists() {
|
||||||
|
|
Loading…
Reference in New Issue