refactor: if the file exists locally, pull from out own node before fetching it from the net
This commit is contained in:
parent
e489de1e86
commit
4261bb6a5d
|
@ -309,6 +309,20 @@ func (f *S5File) Manifest() (s5libmetadata.Metadata, error) {
|
|||
cid = f.CID()
|
||||
}
|
||||
|
||||
if f.Exists() {
|
||||
data, err := io.ReadAll(f)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
md, err := f.protocol.Node().Services().Storage().ParseMetadata(data, cid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return md, nil
|
||||
}
|
||||
|
||||
meta, err := f.protocol.Node().Services().Storage().GetMetadataByCID(cid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue