taylorfinnell / awscr-s3

A Crystal shard for S3.
https://taylorfinnell.github.io/awscr-s3/
MIT License
81 stars 48 forks source link

An issue (maybe?) with `FileUploader` #102

Open igor-alexandrov opened 3 years ago

igor-alexandrov commented 3 years ago

Hey! I got a problem with Shrine (https://github.com/jetrockets/shrine.cr). In some cases (one of our applications that worked with 0.35 before and new Shrine specs), we are getting an error that is below. Maybe it is not really problem of FileUploader, but for sure not all subclasses of IO respond to size.

Do you have any ideas how this can be solved?

In src/shrine/storage/s3.cr:57:18

 57 | uploader.upload(bucket, object_key(id), io, options)
               ^-----
Error: instantiating 'Awscr::S3::FileUploader#upload(String, String, IO+, Hash(String, String))'

In lib/awscr-s3/src/awscr-s3/file_uploader.cr:32:13

 32 | if io.size < UPLOAD_THRESHOLD
            ^---
Error: undefined method 'size' for IO::ARGF (compile-time type is IO+)