Commit e4030de
committed
[FIX] core: square up guess_mimetype implementations
`_odoo_guess_mimetype` requires bytes upfront as `_Entry.signatures`
are lists of bytes, thus `bin_data.startswith(signature)` requires
that `bin_data` be `bytes`.
Forthe libmagic version this is a bit more dodgy: `magic` accepts
`str` (and encodes under the hood if so) for Python 2 compatibility
reasons, but the `guess_mimetypes` wrapper will trigger an unhelpful
warning if libmagic recognizes a zip or ole file.
Update the libmagic version to reject str inputs.
Part-of: odoo#238151
Related: odoo/enterprise#100985
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>1 parent fa4307b commit e4030de
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
192 | 194 | | |
193 | 195 | | |
194 | 196 | | |
| |||
0 commit comments