Skip to content

Commit

Permalink
Always read plugin manifest as UTF-8
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ekohl committed Nov 6, 2020
1 parent 15ffa71 commit 1b965ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/jenkins/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1b965ee

Please sign in to comment.