From ae3a0ec27e26f4a725d7b58ea15410f8820d114c Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 19 Jan 2016 08:20:23 +0000 Subject: [PATCH] b2: Don't re-read the SHA1 if we already have it --- b2/b2.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/b2/b2.go b/b2/b2.go index e76b61634..6cf6fa115 100644 --- a/b2/b2.go +++ b/b2/b2.go @@ -614,11 +614,12 @@ func (o *Object) Hash(t fs.HashType) (string, error) { if t != fs.HashSHA1 { return "", fs.ErrHashUnsupported } - - // Error is logged in readFileMetadata - err := o.readFileMetadata() - if err != nil { - return "", err + if o.sha1 == "" { + // Error is logged in readFileMetadata + err := o.readFileMetadata() + if err != nil { + return "", err + } } return o.sha1, nil }