From 1b965eef66f124e22366722f6581dc6c075ef5ff Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 5 Nov 2020 11:02:43 +0100 Subject: [PATCH] Always read plugin manifest as UTF-8 The manifest can contain UTF-8 data and if no LANG is set (like in minimal environments), this causes the read to fail. This forces it to read the file using UTF-8 encoding. --- lib/puppet/jenkins/plugins.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/jenkins/plugins.rb b/lib/puppet/jenkins/plugins.rb index 3d8f87714..76a356ab4 100644 --- a/lib/puppet/jenkins/plugins.rb +++ b/lib/puppet/jenkins/plugins.rb @@ -54,7 +54,7 @@ def self.available manifest = File.join(plugin_dir, 'META-INF', 'MANIFEST.MF') begin - manifest = manifest_data(File.read(manifest)) + manifest = manifest_data(File.read(manifest, encoding: 'UTF-8')) plugins[plugin] = manifest if manifest rescue StandardError # Nothing really to do about it, failing means no version which will @@ -83,7 +83,7 @@ def self.exists? # # @return [Hash] Parsed version of the update center JSON def self.plugins_from_updatecenter(filename) - buffer = File.read(filename) + buffer = File.read(filename, encoding: 'UTF-8') return {} if buffer.nil? || buffer.empty? # Trim off the first and last lines, which are the JSONP gunk