fix: only try to fetch proof file if we are over the post limit
This commit is contained in:
parent
a1572b256b
commit
7ec4f26142
13
api/s5/s5.go
13
api/s5/s5.go
|
@ -1773,13 +1773,6 @@ func (s *S5API) pinImportCronJob(cid string, url string, proofUrl string, userId
|
|||
|
||||
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.
|
||||
if parsedCid.Size <= s.config.Config().Core.PostUploadLimit {
|
||||
fileData, err := fetchAndProcess(url)
|
||||
|
@ -1810,6 +1803,12 @@ func (s *S5API) pinImportCronJob(cid string, url string, proofUrl string, userId
|
|||
return nil
|
||||
}
|
||||
|
||||
// Fetch proof.
|
||||
proof, err := fetchAndProcess(proofUrl)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
baoProof := bao.Result{
|
||||
Hash: parsedCid.Hash.HashBytes(),
|
||||
Proof: proof,
|
||||
|
|
Loading…
Reference in New Issue