-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Handle multipart form upload with empty file as BadPart #8882
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
framework/src/play/src/main/scala/play/core/parsers/Multipart.scala
Outdated
Show resolved
Hide resolved
framework/src/play/src/main/scala/play/core/parsers/Multipart.scala
Outdated
Show resolved
Hide resolved
.../play-integration-test/src/test/scala/play/it/http/parsing/MultipartFormDataParserSpec.scala
Outdated
Show resolved
Hide resolved
@marcospereira Please have a look again. Now an empty file will not even be created anymore. I added a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks, @mkurz.
@@ -340,11 +340,11 @@ object Multipart { | |||
def parseHeader(input: ByteString, headerStart: Int, memoryBufferSize: Int): StateResult = { | |||
input.indexOfSlice(crlfcrlf, headerStart) match { | |||
case -1 if input.length - headerStart >= maxHeaderSize => | |||
bufferExceeded("Header length exceeded buffer size of " + memoryBufferSize) | |||
bufferExceeded("Header length exceeded maximum header size of " + maxHeaderSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
This still needs to be backported to 2.7.x, seems like it was overlooked. |
* Handle multipart form upload with empty file as BadPart * Fix failing test because empty file isn't available anymore * Better error log * Revert original fix * Handle multipart form upload with empty file as BadPart * More test cases * Correct error message * Migration notes + mention behaviour in upload docs * One more test (file with newline only)
Backported to 2.7.x (cc9783d) |
#8880 was for empty filenames, this is for empty files.