Skip to content

Commit

Permalink
fix: upload size
Browse files Browse the repository at this point in the history
  • Loading branch information
0x-jerry committed Aug 7, 2023
1 parent bbc8560 commit 98a670d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion minio/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ func (mo *file) Stat() (os.FileInfo, error) {
func (mo *file) ReadFrom(r io.Reader) (n int64, err error) {
ctx := context.Background()

_, err = mo.fs.client.PutObject(ctx, mo.fs.BucketName, strings.TrimPrefix(mo.name, "/"), r, -1, minio.PutObjectOptions{ContentType: "application/octet-stream"})
log.Println("Start uploading:", mo.name)

info, err := mo.fs.client.PutObject(ctx, mo.fs.BucketName, strings.TrimPrefix(mo.name, "/"), r, -1, minio.PutObjectOptions{ContentType: "application/octet-stream"})

if err != nil {
log.Println("Upload failed", err)
return 0, err
}

n = info.Size

log.Println("Successfully uploaded bytes: ", n)

return n, nil
Expand Down

0 comments on commit 98a670d

Please sign in to comment.