File upload: Unexpected byte 0xff in UTF-8 byte sequence from parse_multipart
Using the example found at http://kemalcr.com/docs/file_upload/ causes an error in Kemal.
If I upload an image file curl --form "[email protected]" http://localhost:3000/upload, there is an unexpected character Unexpected byte 0xff in UTF-8 byte sequence from parse_multipart. The return code: 500.
In comparison, if I upload a text file curl --form "[email protected]" http://localhost:3000/upload, the first character is lost: puts "HEADERS: #{f.headers}" shows "his a test" while I was expecting "this a test". The return code: 200.
Code:
require 'kemal'
module Kemal1
post "/upload" do |env|
parse_multipart(env) do |f|
puts "HEADERS: #{f.headers}"
end
end
Kemal.run
end
It looks like that its just using multipart.cr. So you may want to create an issue there. However, there should be some specs here.
EDIT: looking at multipar.cr, it looks like it was updated recently (today). You might want to try updating your dependencies.
I've got a fork of kemal with this updated. It's only temp while testing this fix. I'm sure kemal will have a new release soon.
perhaps use crisward/kemal while you're waiting...?
thank you, it's working now