diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2019-03-22 18:48:56 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2019-03-22 18:48:56 +0000 |
commit | cb9b166e08be51bff9b0a98ce266507c702740eb (patch) | |
tree | cd05ff355ef9c2b46a11037a061ee565a1dc7539 | |
parent | e510d1ab93eaf52725e9c9bb7b6e13451253c201 (diff) | |
download | sos-cb9b166e08be51bff9b0a98ce266507c702740eb.tar.gz |
[Plugin] decode content read from file in do_file_sub()
Fixes: #1614
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/plugins/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
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: |