Skip to content

Commit

Permalink
Merge pull request #133 from godcong/master
Browse files Browse the repository at this point in the history
fix #132
  • Loading branch information
Stebalien committed Oct 27, 2020
2 parents f67d2ad + aa5fad3 commit 952470e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ var (
return os.Remove(path)
}

InsideGUI = func() bool { return false }
InsideGUI = func() bool { return false }
ShellTimeOut = 5 * time.Minute
)

func init() {
Expand Down Expand Up @@ -98,17 +99,15 @@ func Fetch(ipfspath string) (io.ReadCloser, error) {
ep, err := ApiEndpoint(IpfsDir())
if err == nil {
sh := api.NewShell(ep)
sh.SetTimeout(ShellTimeOut)
if sh.IsUp() {
stump.VLog(" - using local ipfs daemon for transfer")
rc, err := sh.Cat(ipfspath)
if err != nil {
return nil, err
if err == nil {
return newLimitReadCloser(rc, fetchSizeLimit), nil
}

return newLimitReadCloser(rc, fetchSizeLimit), nil
}
}

return httpFetch(GlobalGatewayUrl + ipfspath)
}

Expand Down

0 comments on commit 952470e

Please sign in to comment.