From 7ec4f261420178eb44e371691bdfc93b8caf8127 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Fri, 1 Mar 2024 04:01:22 -0500 Subject: [PATCH] fix: only try to fetch proof file if we are over the post limit --- api/s5/s5.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/api/s5/s5.go b/api/s5/s5.go index b0e0c3c..d486c93 100644 --- a/api/s5/s5.go +++ b/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,