1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-05 10:58:07 +01:00
Marcus Huewe d85030b72d Fix python2 regression in util.helper.decode_it
In commit 276d6e2439c8c53c182dbe785b038919e64da9f3 ("Do not use the
chardet module in util.helper.decode_it") util.helper.decode_it was
changed to always decode the passed object if it has a decode method.
Since a python2 str has a decode method, the new code tries to utf-8
decode the passed str. As a result, a unicode object is returned (if
the decoding worked). Since a unicode object is not an instance of
type str, all subsequent isinstance(decoded_obj, str) checks evaluate
to False, which break some codepaths.
In order to fix this, restore the old python2 behavior (that is, if
the passed object is a str, it is not decode it). This change does not
affect the python3 codepaths.

Fixes: #814 ("osc log | fails")
2020-06-25 15:38:14 +02:00
..
2009-12-03 19:19:53 +01:00
2014-08-12 15:01:16 +02:00
2020-06-15 20:53:38 +02:00
2020-04-14 14:50:24 +10:00
2020-06-08 20:31:28 +02:00
2019-08-29 16:11:17 +02:00