Fix return value from guess_mimetype on Python 3.
Review Request #11186 — Created Sept. 19, 2020 and submitted
Mimetype guessing was returning the mimetype as
bytes
rather than
str
(unicode
), due to the default behavior ofsubprocess.Popen
. On
Python 2 this is fine because bytes and unicode are pretty freely
intercompatible, but on Python 3 this would then explode later on when
attempting to serialize a file attachment object with that mimetype set,
sinceparse_mimetype
didn't understandbytes
.While I was here I fixed the order of arguments in a log message to make
more sense.
I had been experiencing problems when using certain Review Bot tools
with the Review Board server running on Python 3.8. When the tool
attempted to create thetool-output
attachment, it would get an error
serializing "bytes" and spit out a warning about being unable to parse
the mimetype. After this change, everything works as expected.
Summary | ID |
---|---|
24f39e831a8eef87ac603e06a78e1d8975a75afe |