fix: only try to fetch proof file if we are over the post limit

This commit is contained in:
Derrick Hammer 2024-03-01 04:01:22 -05:00
parent a1572b256b
commit 7ec4f26142
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 7 deletions

View File

@ -1773,13 +1773,6 @@ func (s *S5API) pinImportCronJob(cid string, url string, proofUrl string, userId
return nil return nil
} }
// Fetch proof.
proof, err := fetchAndProcess(proofUrl)
if err != nil {
return err // Error logged in fetchAndProcess
}
// Fetch file and process if under post upload limit. // Fetch file and process if under post upload limit.
if parsedCid.Size <= s.config.Config().Core.PostUploadLimit { if parsedCid.Size <= s.config.Config().Core.PostUploadLimit {
fileData, err := fetchAndProcess(url) fileData, err := fetchAndProcess(url)
@ -1810,6 +1803,12 @@ func (s *S5API) pinImportCronJob(cid string, url string, proofUrl string, userId
return nil return nil
} }
// Fetch proof.
proof, err := fetchAndProcess(proofUrl)
if err != nil {
return err
}
baoProof := bao.Result{ baoProof := bao.Result{
Hash: parsedCid.Hash.HashBytes(), Hash: parsedCid.Hash.HashBytes(),
Proof: proof, Proof: proof,