From 77a520c97c95cb4e51dfa1e4a17752630051a802 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 1 Oct 2019 12:34:38 +0100 Subject: [PATCH] fichier: fix accessing files > 2GB on 32 bit systems - fixes #3581 --- backend/fichier/fichier.go | 2 +- backend/fichier/object.go | 4 ++-- backend/fichier/structs.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/fichier/fichier.go b/backend/fichier/fichier.go index 820a47e46..e81fe80e7 100644 --- a/backend/fichier/fichier.go +++ b/backend/fichier/fichier.go @@ -348,7 +348,7 @@ func (f *Fs) putUnchecked(ctx context.Context, in io.Reader, remote string, size Date: time.Now().Format("2006-01-02 15:04:05"), Filename: link.Filename, Pass: 0, - Size: int(fileSize), + Size: fileSize, URL: link.Download, }, }, nil diff --git a/backend/fichier/object.go b/backend/fichier/object.go index f8e918722..7a152b9ab 100644 --- a/backend/fichier/object.go +++ b/backend/fichier/object.go @@ -43,7 +43,7 @@ func (o *Object) ModTime(ctx context.Context) time.Time { // Size returns the size of the file func (o *Object) Size() int64 { - return int64(o.file.Size) + return o.file.Size } // Fs returns read only access to the Fs that this object is part of @@ -74,7 +74,7 @@ func (o *Object) SetModTime(context.Context, time.Time) error { // Open opens the file for read. Call Close() on the returned io.ReadCloser func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadCloser, error) { - fs.FixRangeOption(options, int64(o.file.Size)) + fs.FixRangeOption(options, o.file.Size) downloadToken, err := o.fs.getDownloadToken(ctx, o.file.URL) if err != nil { diff --git a/backend/fichier/structs.go b/backend/fichier/structs.go index b5487b59f..796c7568d 100644 --- a/backend/fichier/structs.go +++ b/backend/fichier/structs.go @@ -69,7 +69,7 @@ type SharedFolderResponse []SharedFile type SharedFile struct { Filename string `json:"filename"` Link string `json:"link"` - Size int `json:"size"` + Size int64 `json:"size"` } // EndFileUploadResponse is the response structure of the corresponding request @@ -93,7 +93,7 @@ type File struct { Date string `json:"date"` Filename string `json:"filename"` Pass int `json:"pass"` - Size int `json:"size"` + Size int64 `json:"size"` URL string `json:"url"` }