Hey all,
I can't seem to get a binary file out from couchdb using couchrest without it being corrupted. I haven't seen many examples, so I'm probably doing something very wrong, but if anyone could point me in a direction, that would be most helpful.
From within a rack request, I've got some code that looks a little like this:
request.params.each do |k, v|
submission.create_attachment(
:file => v[:tempfile],
:name => v[:filename]
)
end
with "submission" being my couchrest model. The :tempfile is straight from rack. When I use #fetch_attachment, I seem to be getting base64 encoded data back. Shouldn't #fetch_attachment unencode this data? Also, I noticed in core/database.rb, you seem to be encoding the data as base64, then modifying it by using gsub /\s/, "". Won't this make the binary data unable to be decoded?
Thanks,
Justin