I am getting this error when trying to pass in an image:
!! Unexpected error while processing request: invalid byte sequence in UTF-8
The weird thing is that the raise (as below) did not get executed.
My question is: how can this happen to cause this error? Has it got anything to do with the headers or the params?
Any help here will be appreciated.
def create
raise "request did get executed in code here"
debugger
@asset = nil
if params && params[:asset]
p = params[:asset]
if p[:file]
user_id = p[:user_id] || current_user.try(:id)
checksum = p[:checksum] || Util.file_checksum(p[:file].path)
if user_id.present? && checksum.present?
options = {:taken_at => p[:taken_at] || Util.file_taken_at(p[:file].path)}
@asset = Asset.create user_id, checksum, p[:file], p[:file].original_filename, options
end
end
end
respond_to do |format|
if @asset && @asset.state != QueueItem::STATE_NONE
format.html { head :no_content }
format.json { render :json => @asset, :status => :created }
else
format.html { head :no_content }
format.json { render :json => @asset.try(:errors), :status => :unprocessable_entity }
end
end
end