You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to parse form data: java.lang.IllegalStateException: UT000017: Form value is a file, use getFileItem() instead
java.lang.IllegalStateException: UT000017: Form value is a file, use getFileItem() instead
at io.undertow.server.handlers.form.FormData$FormValueImpl.getValue(FormData.java:351)
at cask.model.FormEntry$.fromUndertow(Params.scala:102)
The method cask.model.FormEntry#fromUndertow is naively implemented and does not take into account optional field values. Browsers AFAIK will always send fields even if they are empty, it's up to the server/app to decide what emptiness means.
At the very least I would expect fromUndertow to return Option[FormEntry] and let the postForm decorator deal with it.
Below is an example request from Firefox, but I would expect all browsers to behave the same.
I tried to take a stab at fixing this but the project doesn't compile (tried all tags as low as 0.9.0) and the error messages are too cryptic for me (scala.reflect.internal.FatalError: bad constant pool index: 0 at pos: 48454 wtf?!). Let me know if you want me to open a ticket for that also.
The text was updated successfully, but these errors were encountered:
The only user facing change is that now FormFile.filePath is optional. I think it's a good compromise instead of forcing users to expect Option[FormFile] parameters in their endpoints.
I was debating whether fileName should also be optional. I chose to let it accept null values, happy to change it someone thinks otherwise.
case class FormFile(fileName: String,
filePath: Option[java.nio.file.Path], <-- users will see this
headers: io.undertow.util.HeaderMap) extends FormEntry{
def valueOrFileName = fileName
}
Minimal repro:
Stacktrace:
The method
cask.model.FormEntry#fromUndertow
is naively implemented and does not take into account optional field values. Browsers AFAIK will always send fields even if they are empty, it's up to the server/app to decide what emptiness means.At the very least I would expect
fromUndertow
to return Option[FormEntry] and let thepostForm
decorator deal with it.Below is an example request from Firefox, but I would expect all browsers to behave the same.
I tried to take a stab at fixing this but the project doesn't compile (tried all tags as low as 0.9.0) and the error messages are too cryptic for me (
scala.reflect.internal.FatalError: bad constant pool index: 0 at pos: 48454
wtf?!). Let me know if you want me to open a ticket for that also.The text was updated successfully, but these errors were encountered: