b2: Don't re-read the SHA1 if we already have it
This commit is contained in:
parent
d9458fb4ee
commit
ae3a0ec27e
1 changed files with 6 additions and 5 deletions
3
b2/b2.go
3
b2/b2.go
|
@ -614,12 +614,13 @@ func (o *Object) Hash(t fs.HashType) (string, error) {
|
||||||
if t != fs.HashSHA1 {
|
if t != fs.HashSHA1 {
|
||||||
return "", fs.ErrHashUnsupported
|
return "", fs.ErrHashUnsupported
|
||||||
}
|
}
|
||||||
|
if o.sha1 == "" {
|
||||||
// Error is logged in readFileMetadata
|
// Error is logged in readFileMetadata
|
||||||
err := o.readFileMetadata()
|
err := o.readFileMetadata()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return o.sha1, nil
|
return o.sha1, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue