Fix crashes that could occur when detecting file mimetypes.
Review Request #14229 — Created Nov. 5, 2024 and updated
This change mirrors a similar fix that we recently did for Review Board.
This fixes two issues with RBTools' MIME-type detection:
Some versions of Python break if you try to close an already-closed
pipe, and this had happened on one customer's machine.file
may
close the input stream once it's read enough data to make a
determination, and our attempt to close would then fail.Errors executing or communicating with
file
would crash.
Ran unit tests.
Summary | ID |
---|---|
8194c13c7aa42077a8f71dbf57930a267a6d15b3 |
- Description:
-
This change mirrors a similar fix that we recently did for Review Board.
This fixes two issues with RBTools' MIME-type detection: -
Some versions of Python break if you try to close an already-closed
pipe, and this had happened on one customer's machine.file
may
close the input stream once it's read enough data to make a
determination, and our attempt to close would then fail.
~ -
Errors executing or communicating with
file
would crash, and even
if caught higher up it'd leave the uploaded file truncated (the file
pointer wouldn't be at 0).
~ -
Errors executing or communicating with
file
would crash.
-