fix: need to use hashBytes and an optional type

This commit is contained in:
Derrick Hammer 2024-03-01 22:46:42 -05:00
parent a1f36df8b9
commit f79a0dd448
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 2 deletions

View File

@ -1657,6 +1657,7 @@ func (s *S5API) downloadFile(jc jape.Context) {
}
var hashBytes []byte
var typ types.CIDType
isProof := false
if strings.HasSuffix(cid, storage.PROOF_EXTENSION) {
@ -1676,11 +1677,12 @@ func (s *S5API) downloadFile(jc jape.Context) {
hashBytes = hashDecoded.HashBytes()
} else {
hashBytes = cidDecoded.Hash.HashBytes()
typ = cidDecoded.Type
}
file := s.newFile(FileParams{
Hash: cidDecoded.Hash.HashBytes(),
Type: cidDecoded.Type,
Hash: hashBytes,
Type: typ,
})
if !file.Exists() {