From cb9b166e08be51bff9b0a98ce266507c702740eb Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Fri, 22 Mar 2019 18:48:56 +0000 Subject: [Plugin] decode content read from file in do_file_sub() Fixes: #1614 Signed-off-by: Bryn M. Reeves --- sos/plugins/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index 6c588a96..da5c2f72 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -493,7 +493,10 @@ class Plugin(object): if not path: return 0 readable = self.archive.open_file(path) - result, replacements = re.subn(regexp, subst, readable.read()) + content = readable.read() + if not isinstance(content, six.string_types): + content = content.decode('utf8', 'ignore') + result, replacements = re.subn(regexp, subst, content) if replacements: self.archive.add_string(result, srcpath) else: -- cgit