[obs-commits] [openSUSE/osc] 16a3fc: Handle bytes vs. str error when parsing meta (#683)
Branch: refs/heads/master Home: https://github.com/openSUSE/osc Commit: 16a3fcfabf747820b5d6605ff8d0e155916194a4 https://github.com/openSUSE/osc/commit/16a3fcfabf747820b5d6605ff8d0e15591619... Author: Kristoffer Grönlund <kgronlund@suse.com> Date: 2020-02-07 (Fri, 07 Feb 2020) Changed paths: M osc/commandline.py M osc/core.py Log Message: ----------- Handle bytes vs. str error when parsing meta (#683) In all the cases where meta_exists returns either string data, bytes data or a list, the output needs to be parsed correctly. Signed-off-by: Kristoffer Grönlund <kgronlund@suse.com> Commit: 32859d6803eff3cd201d2f9c93b9433cc9681fce https://github.com/openSUSE/osc/commit/32859d6803eff3cd201d2f9c93b9433cc9681... Author: Marcus Huewe <suse-tux@gmx.de> Date: 2020-02-07 (Fri, 07 Feb 2020) Changed paths: M osc/commandline.py M osc/core.py Log Message: ----------- Merge branch 'handle-string-conversion' of https://github.com/krig/osc Add core.parse_meta_to_string helper to work around the insane implementation of core.meta_exists. Since core.meta_exists may return a list of bytes, a str, a list of str etc., we ultimately convert the data to str before passing it ET.fromstring(...). In case of bytes, the explicit decoding is OK because it is assumed to be a valid utf-8 encoding (the data represents an xml). Note: at the moment core.parse_meta_to_string is also called even if it is not necessary (it is only necessary if the "create" parameter of a corresponding core.meta_exists call is True). Note 2: this is just a temporary workaround and, eventually, we will make the implementation of core.meta_exists more reasonable. When doing so, we will also remove "public" function core.parse_meta_to_string again. (Yes, this breaks API but the core.meta_exists change will also break the API in some sense - so that's OK.) Compare: https://github.com/openSUSE/osc/compare/fb9e64c2f1be...32859d6803ef
participants (1)
-
Marcus Hüwe