Fix _get_file_contents to return bytes and checking that a different file exists than it opens

This commit is contained in:
Toshio Kuratomi 2017-07-28 09:14:08 -07:00
commit cce06c5a3b
2 changed files with 17 additions and 9 deletions

View file

@ -102,7 +102,8 @@ class LookupModule(LookupBase):
paramvals['section'] = 'java_properties'
# Open file using encoding
contents, show_data = self._loader._get_file_contents(path, encoding=paramvals['encoding'])
contents, show_data = self._loader._get_file_contents(path)
contents = to_text(contents, errors='surrogate_or_strict', encoding=paramvals['encoding'])
config.write(contents)
config.seek(0, os.SEEK_SET)