summaryrefslogtreecommitdiff
path: root/internal/media/util.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-09-29 21:50:43 +0100
committerLibravatar GitHub <noreply@github.com>2022-09-29 21:50:43 +0100
commit1d999712e6902414bbac30db8a5603758c5c539c (patch)
tree6d4da7aaa8c1e7fc94c5723703f13e5b6d062dfc /internal/media/util.go
parent[chore] Add ipv6 localhost to trusted proxies by default (#868) (diff)
downloadgotosocial-1d999712e6902414bbac30db8a5603758c5c539c.tar.xz
[feature] update config types to use bytesize.Size (#828)
* update config size types to use bytesize.Size * submit unchecked-out file ... :facepalm: * fix bytesize config var decoding * bump bytesize version * update kim's libraries in readme * update envparse.sh to output more useful errors * improve envparse.sh * remove reliance on jq * instead, use uint64 for bytesize flag types * remove redundant type * fix viper unmarshaling * Update envparsing.sh * fix envparsing test Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Diffstat (limited to 'internal/media/util.go')
-rw-r--r--internal/media/util.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/media/util.go b/internal/media/util.go
index b89196f87..2968ca2f6 100644
--- a/internal/media/util.go
+++ b/internal/media/util.go
@@ -151,19 +151,19 @@ func parseOlderThan(olderThanDays int) (time.Time, error) {
// lengthReader wraps a reader and reads the length of total bytes written as it goes.
type lengthReader struct {
source io.Reader
- length int
+ length int64
}
func (r *lengthReader) Read(b []byte) (int, error) {
n, err := r.source.Read(b)
- r.length += n
+ r.length += int64(n)
return n, err
}
// putStream either puts a file with a known fileSize into storage directly, and returns the
// fileSize unchanged, or it wraps the reader with a lengthReader and returns the discovered
// fileSize.
-func putStream(ctx context.Context, storage storage.Driver, key string, r io.Reader, fileSize int) (int, error) {
+func putStream(ctx context.Context, storage storage.Driver, key string, r io.Reader, fileSize int64) (int64, error) {
if fileSize > 0 {
return fileSize, storage.PutStream(ctx, key, r)
}