Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing Tempfile from Rack to Exif::Data.new raises an error #13

Closed
Aupajo opened this issue Oct 19, 2017 · 3 comments
Closed

Passing Tempfile from Rack to Exif::Data.new raises an error #13

Aupajo opened this issue Oct 19, 2017 · 3 comments

Comments

@Aupajo
Copy link

Aupajo commented Oct 19, 2017

If I have an upload coming from Rack:

> file
#<Tempfile:/var/folders/r4/rd0m9j997h19dm1nz9_fg2540000gn/T/RackMultipart20171019-54278-1v4nvvt.jpg>

If I try to parse it with Exif::Data.new, I get the following error:

> Exif::Data.new(file)
TypeError: wrong argument type Tempfile (expected String or IO)
@tonytonyjan
Copy link
Owner

This is expected behavior since Tempfile is not an IO but a DelegateClass(File). A workaround would be calling Tempfile#read before passing it to Exif::Data.new.

In fact, I am thinking about to add a feature to support objects with some interfaces like #read being implemented and thus some built-in class like StringIO and Tempfile can work.

@tonytonyjan
Copy link
Owner

exif v2.1.0 has been released and it should solve this issue. Thanks for making exif better :)

@Aupajo
Copy link
Author

Aupajo commented Oct 20, 2017

@tonytonyjan Thank you for the quick fix 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants