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

500 in production #1

Open
tbodnya opened this issue Mar 29, 2013 · 0 comments
Open

500 in production #1

tbodnya opened this issue Mar 29, 2013 · 0 comments
Assignees

Comments

@tbodnya
Copy link
Member

tbodnya commented Mar 29, 2013

Installed 2.0.0, in development all works fine, in production after all necessary configurations it breaks at
bcms_webdav (2.0.0) lib/bcms_webdav/resource.rb:192:in `extract_tempfile'

Here is the full log:
Paperclip::AdapterRegistry::NoHandlerError (No handler found for #<PhusionPassenger::Utils::RewindableInput:0xb6a8b54 @io=#<PhusionPassenger::Utils::UnseekableSoc
ket:0xc07de90 @socket=#<UNIXSocket:fd 12>>, @rewindable_io=nil, @unlinked=false>):
paperclip (3.0.4) lib/paperclip/io_adapters/registry.rb:19:in handler_for' paperclip (3.0.4) lib/paperclip/io_adapters/registry.rb:29:infor'
bcms_webdav (2.0.0) lib/bcms_webdav/resource.rb:192:in extract_tempfile' bcms_webdav (2.0.0) lib/bcms_webdav/resource.rb:137:input'
dav4rack (0.2.11) lib/dav4rack/resource.rb:116:in method_missing' dav4rack (0.2.11) lib/dav4rack/controller.rb:83:input'
dav4rack (0.2.11) lib/dav4rack/handler.rb:30:in call' bcms_webdav (2.0.0) lib/bcms_webdav/web_dav_middleware.rb:20:incall'
.....

Found the fix (http://stackoverflow.com/questions/15172439/paperclip-and-phusion-passenger-nohandlererror):
The example you're cribbing from expects the file stream to be a StringIO object, but Passenger is giving you a PhusionPassenger::Utils::RewindableInput object instead.

Fortunately, a RewindableInput is duckalike to StringIO for this case, so Paperclip's StringioAdapter can be used to wrap your upload stream.

Inside the if block in your parse_raw_upload, at the end, do:

if @raw_file.class.name == 'PhusionPassenger::Utils::RewindableInput'
@raw_file = Paperclip::StringioAdapter.new(@raw_file)
end

In my project overwrote the Resource file,put it in initializer. Updated extract_tempfile method and changed line 192 to be:
if request.body.class.name == 'PhusionPassenger::Utils::RewindableInput'
uploaded_file = Paperclip::StringioAdapter.new(request.body)
else
uploaded_file = Paperclip.io_adapters.for(request.body)
end

Was able to move my files after that.

@ghost ghost assigned peakpg Mar 29, 2013
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