]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
toaster: open image files in binary mode when sending in response
authorElliot Smith <elliot.smith@intel.com>
Tue, 7 Jun 2016 15:37:29 +0000 (16:37 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 14 Jun 2016 10:08:58 +0000 (11:08 +0100)
commitc4d67968d0ec1d5ff53cdc0dccf6a7869c89597b
treec4600df16004652b1f83664b638273a8201eded7
parent571c2b70d3c123614618672ce7532bb5f4c36630
toaster: open image files in binary mode when sending in response

The view code for downloading image files used the "r" flag
to read the file, then used the open file object to form the
HTTP response.

While this worked in Python 2, Python 3 appears to be more strict
about this sort of thing, and Django throws a UnicodeDecodeError
when a file opened this way is used in a response.

Open the file with the "b" flag (binary mode) so that Django can
correctly convert the binary file handle to an HTTP response.

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
lib/toaster/toastergui/views.py