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

Unprocessable Entity (422) when uploading file with non-English name #1767

Closed
tenniscp25 opened this issue Apr 4, 2018 · 7 comments
Closed

Unprocessable Entity (422) when uploading file with non-English name #1767

tenniscp25 opened this issue Apr 4, 2018 · 7 comments

Comments

@tenniscp25
Copy link

@tenniscp25 tenniscp25 commented Apr 4, 2018

With the following code:

import cats.effect._
import org.http4s._
import org.http4s.dsl.io._
import org.http4s.multipart._

object TestService {
  val service = HttpService[IO] {
    case req @ POST -> Root / "test" =>
      req.decode[Multipart[IO]](_ => Ok("Done"))
  }
}

I tried Thai, Japanese and Chinese file names. The server always return HTTP 422. English names work fine though. Example names that fail: ทดสอบ, テスト and 实验.

@jmcardon
Copy link
Member

@jmcardon jmcardon commented Apr 4, 2018

Hi.

The Multipart RFC suggests to use ascii names when possible, and if not using ascii, at least being consistent.

Currently, we only support ascii, but I'm opening a PR in a little to tackle that issue

@rossabaker
Copy link
Member

@rossabaker rossabaker commented Apr 4, 2018

We're not bumping into 5.1.3 of that spec yet, are we? I think we've got some unresolved issues around that, as well.

@jmcardon
Copy link
Member

@jmcardon jmcardon commented Apr 4, 2018

I think utf8 as a default is ok. Seems like everyone else is ignoring that part of the rfc...

@tenniscp25
Copy link
Author

@tenniscp25 tenniscp25 commented Apr 4, 2018

Sorry, I never knew about the spec before.

Am I correct that, in the meantime, the client and the server have to agree on how to encode the file name, like using URLEncoder with UTF-8 character encoding?

@jmcardon
Copy link
Member

@jmcardon jmcardon commented Apr 4, 2018

@tenniscp25 #1768 addresses your issue.

@jmcardon
Copy link
Member

@jmcardon jmcardon commented Apr 5, 2018

Closed by #1768 . Please upgrade to 0.18.7 to deal with non-ascii chars 👍

@jmcardon jmcardon closed this Apr 5, 2018
@tenniscp25
Copy link
Author

@tenniscp25 tenniscp25 commented Apr 5, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.