forked from TrueCloudLab/rclone
box: Parse file/directory size as a floating point number
Very large directories can have their sizes returned as floating point numbers, eg `1.0034576985781e+14` from the box API. Before this change this would fail to parse as an int64. This change parses the size as a float64 instead which will be perfectly accurate for sizes up to 2**56 which is about 9 PB. It is unknown whether box themselves use a float64 as an intermediate representation in the API or not - it seems likely. Fixes #2261
This commit is contained in:
parent
1f255a8567
commit
a0c65deca8
2 changed files with 13 additions and 13 deletions
|
@ -80,7 +80,7 @@ type Item struct {
|
|||
Etag string `json:"etag"`
|
||||
SHA1 string `json:"sha1"`
|
||||
Name string `json:"name"`
|
||||
Size int64 `json:"size"`
|
||||
Size float64 `json:"size"` // box returns this in xEyy format for very large numbers - see #2261
|
||||
CreatedAt Time `json:"created_at"`
|
||||
ModifiedAt Time `json:"modified_at"`
|
||||
ContentCreatedAt Time `json:"content_created_at"`
|
||||
|
|
|
@ -883,7 +883,7 @@ func (o *Object) setMetaData(info *api.Item) (err error) {
|
|||
return errors.Wrapf(fs.ErrorNotAFile, "%q is %q", o.remote, info.Type)
|
||||
}
|
||||
o.hasMetaData = true
|
||||
o.size = info.Size
|
||||
o.size = int64(info.Size)
|
||||
o.sha1 = info.SHA1
|
||||
o.modTime = info.ModTime()
|
||||
o.id = info.ID
|
||||
|
|
Loading…
Reference in a new issue