When upgrading from paperclip 2 to paperclip 3 my image upload API brakes. This code used to work :
def decode_cover_image_data(cover_image_data)
data = StringIO.new(Base64.decode64(cover_image_data))
data.class.class_eval { attr_accessor :original_filename, :content_type }
data.original_filename = "cover.png"
data.content_type = "image/png"
self.photo = data
end
It now raises a NoHandleError exception :
“Paperclip::AdapterRegistry::NoHandlerError (No handler found for
“/9j/4AAQD/4Q[…]wooooGf/9k=”
Did anybody encounter this problem ?
Thanks
I found where the problem was coming from, it’s quite stupid…
In my controller update method i had something like :
The issue is that i’m setting the user photo 2 times :
The crash occured when saving the base64 string (still in the parameters) with update_attributes. Actually what surprise me is that this piece of code works with Paperclip 2.4.5 …
After upgrading to Paperclip 3.3.1 i solved my problem by replacing my update method with this :