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

SanitizedFile should support read with an optional length and output_buffer arguments #1959

Closed
jcoyne opened this issue May 24, 2016 · 1 comment

Comments

@jcoyne
Copy link

jcoyne commented May 24, 2016

Then it would conform to the IO api as documented here: http://ruby-doc.org/core-2.2.2/IO.html#method-i-read

Presently if I have this code:

cwf = Carrierwave::SanitizedFile.new
out = File.new
IO.copy_stream(cwf, out)

Then I get this error:

     ArgumentError:
       wrong number of arguments (given 2, expected 0)
     # /Users/jcoyne/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/carrierwave-0.11.2/lib/carrierwave/sanitized_file.rb:157:in `read'
@janko
Copy link
Contributor

janko commented May 25, 2016

@jcoyne I remember two years ago trying to change CarrierWave::SanitizedFile#read to conform to the IO interface, because I wanted to build a Flickr storage gem, where the Flickr client used Faraday which required these two arguments. When I made changes that I thought could work, a lot of tests were failing for unknown reasons, and I think some of the failures were non-fixable. And it was a bit intimidating that CarrierWave::SanitizedFile can have so many states, which #read also changes. It really can be this simple.

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

No branches or pull requests

3 participants