From fd5c3e831d621434406cadcbfe19e807b2861f2d Mon Sep 17 00:00:00 2001 From: Noah Hsu Date: Thu, 23 Jun 2022 15:57:36 +0800 Subject: [PATCH] chore: change size of file to int64 --- internal/aria2/monitor.go | 2 +- internal/model/obj.go | 2 +- internal/model/object.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/aria2/monitor.go b/internal/aria2/monitor.go index fb55058d..3941963f 100644 --- a/internal/aria2/monitor.go +++ b/internal/aria2/monitor.go @@ -122,7 +122,7 @@ func (m *Monitor) Complete() error { Name: fmt.Sprintf("transfer %s to %s", file.Path, m.dstDirPath), Func: func(tsk *task.Task[uint64]) error { defer wg.Done() - size, _ := strconv.ParseUint(file.Length, 10, 64) + size, _ := strconv.ParseInt(file.Length, 10, 64) mimetype := mime.TypeByExtension(path.Ext(file.Path)) if mimetype == "" { mimetype = "application/octet-stream" diff --git a/internal/model/obj.go b/internal/model/obj.go index 346f300d..43cd7c20 100644 --- a/internal/model/obj.go +++ b/internal/model/obj.go @@ -6,7 +6,7 @@ import ( ) type Obj interface { - GetSize() uint64 + GetSize() int64 GetName() string ModTime() time.Time IsDir() bool diff --git a/internal/model/object.go b/internal/model/object.go index b8124fe8..37bc696a 100644 --- a/internal/model/object.go +++ b/internal/model/object.go @@ -5,7 +5,7 @@ import "time" type Object struct { ID string Name string - Size uint64 + Size int64 Modified time.Time IsFolder bool } @@ -14,7 +14,7 @@ func (f Object) GetName() string { return f.Name } -func (f Object) GetSize() uint64 { +func (f Object) GetSize() int64 { return f.Size }