Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

box: Parse file/directory size as a floating point number

Nick Craig-Wooda0c65deca822
diff --git a/backend/box/api/types.go b/backend/box/api/types.go
index 4b28e34f6..22e637fe5 100644
--- a/backend/box/api/types.go
+++ b/backend/box/api/types.go
@@ -74,18 +74,18 @@ const (
// Item describes a folder or a file as returned by Get Folder Items and others
type Item struct {
- Type string `json:"type"`
- ID string `json:"id"`
- SequenceID string `json:"sequence_id"`
- Etag string `json:"etag"`
- SHA1 string `json:"sha1"`
- Name string `json:"name"`
- Size int64 `json:"size"`
- CreatedAt Time `json:"created_at"`
- ModifiedAt Time `json:"modified_at"`
- ContentCreatedAt Time `json:"content_created_at"`
- ContentModifiedAt Time `json:"content_modified_at"`
- ItemStatus string `json:"item_status"` // active, trashed if the file has been moved to the trash, and deleted if the file has been permanently deleted
+ Type string `json:"type"`
+ ID string `json:"id"`
+ SequenceID string `json:"sequence_id"`
+ Etag string `json:"etag"`
+ SHA1 string `json:"sha1"`
+ Name string `json:"name"`
+ 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"`
+ ContentModifiedAt Time `json:"content_modified_at"`
+ ItemStatus string `json:"item_status"` // active, trashed if the file has been moved to the trash, and deleted if the file has been permanently deleted
}
// ModTime returns the modification time of the item
diff --git a/backend/box/box.go b/backend/box/box.go
index 0f2d2f41f..ef13a28b0 100644
--- a/backend/box/box.go
+++ b/backend/box/box.go
@@ -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