From 65548e8ec7b0d5fd25141a5668b04b9be79cbb90 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 1 Mar 2024 21:44:02 -0500 Subject: [PATCH] refactor: pass cidType to new S5File --- api/s5/s5.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/s5/s5.go b/api/s5/s5.go index b8f1ed6..95837f2 100644 --- a/api/s5/s5.go +++ b/api/s5/s5.go @@ -1678,7 +1678,7 @@ func (s *S5API) downloadFile(jc jape.Context) { hashBytes = cidDecoded.Hash.HashBytes() } - file := s.newFile(s.protocol, hashBytes) + file := s.newFile(s.protocol, hashBytes, cidDecoded.Type) if !file.Exists() { jc.ResponseWriter.WriteHeader(http.StatusNotFound) @@ -1751,12 +1751,13 @@ func (s *S5API) newStorageLocationProvider(hash *encoding.Multihash, excludeSelf }) } -func (s *S5API) newFile(protocol *s5.S5Protocol, hash []byte) *S5File { +func (s *S5API) newFile(protocol *s5.S5Protocol, hash []byte, cidTyp types.CIDType) *S5File { return NewFile(FileParams{ Protocol: protocol, Hash: hash, Metadata: s.metadata, Storage: s.storage, + Type: cidTyp, }) }