Hi, with 3.0.0 RC1, Is there any workaround for `M...
# ktor
r
Hi, with 3.0.0 RC1, Is there any workaround for
Multipart part content length limit of 65536 exceeded
? client:
Copy code
setBody(MultiPartFormDataContent(formData {
          ..
         append("file", ChannelProvider(bytes.size.toLong(), { ByteReadChannel(bytes) }), ...)
server:
Copy code
call.receiveMultipart().forEachPart { ...
(crashes in
forEachPart
) I see something related but not sure if it is 100% the same: https://youtrack.jetbrains.com/issue/KTOR-7356
solved 1
b
call.receiveMultipart(formFieldLimit = BIG_NUMBER)
r
Missed that, thank you!
b
I've upped the limit for next version and included a better exception when it's hit, since this seems like it could be a common source of consternation 👍
thank you color 1
g
Hi @Bruce Hamilton. I migrate to Ktor 3.x and faced this "updated" 50 Mb limit coming from default argument of
receiveMultipart()
. Then I wanted to build a plugin which would apply large limit on
receiveMultipart()
for the whole app, for example by putting desired value to
FormFieldLimit
attribute
onCall {}
. But the default value of
formFieldLimit
argument (those 50 Mb) overrides the value from the attribute. So, right now I don't see any way to implicitly apply upload file size limit with a plugin, you must always explicitly pass the desired limit as an argument to
receiveMultipart()
. Don't you think there should also be an attribute for multipart content, similar to existing
FormFieldLimit
?
b
Oh, looks like an oversight. The FormFieldLimit attribute ought to set the value.
g
Thank you @Bruce Hamilton! Another question then: Shouldn't the
val FORM_FIELD_LIMIT
be publicly available to avoid constructing my own
AttributeKey<Long>("FormFieldLimit")
object and re-typing attribute name, if I want to put another value?