In some cases you have to trim the first 45 bytes that come in from http headers that can also corrupt the file with its extra bytes so you have to load the bytes starting at 45, end. That was an issue I once had and fixed while inspecting the bytearray because i knew the exact size of my bytearray had a larger file size than usual by a little