This repository was archived by the owner on Sep 7, 2022. It is now read-only.

Description
I was trying to parse request body to multipart/form-data using org.apache.commons.fileupload. For that I needed request content as Array[Byte]. I first used getBytes("UTF-8") on body. This worked fine with text files, but for binary files, this didn't seem to work. On further examination, I noticed that the hex for new file was shifted by some amount.
As a workaround, I changed the type of body to Array[Byte] and made these changes in netty/NettyRequest.scala:
val contentLength = nettyRequest.getContent.readableBytes
var byteArray = new Array[Byte](contentLength)
nettyRequest.getContent.readBytes(byteArray)
val body = byteArray
This seemed to work fine with any type of file.