Skip to content

Commit

Permalink
Add binary flag to File.open()'s as a workaround for JRuby windows be…
Browse files Browse the repository at this point in the history
…haviour
  • Loading branch information
thomas- committed Mar 21, 2018
1 parent 1e1d187 commit 8ff1f0b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.generate_manifest(directory)
next
end
# Get hash of file
digest = File.open(pathname) { |f| Digest::SHA256.hexdigest(f.read) }
digest = File.open(pathname, "rb") { |f| Digest::SHA256.hexdigest(f.read) }
# And add to manifest
manifest[filename] = digest
end
Expand Down
2 changes: 1 addition & 1 deletion lib/packing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def self.pack_plugin(plugin, output_directory, errors = [])
minimiser = PluginTool::Minimiser.new
files.each do |filename|
STDOUT.write("."); STDOUT.flush
data = File.open("#{plugin_dir}/#{filename}") { |f| f.read }
data = File.open("#{plugin_dir}/#{filename}", "rb") { |f| f.read }
# Minimise file?
unless filename =~ /\A(js|test)\//
data = minimiser.process(data, filename)
Expand Down
2 changes: 1 addition & 1 deletion lib/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def develop_scan_and_upload(first_run)
PluginTool.post_with_json_response("/api/development-plugin-loader/delete-file/#{@loaded_plugin_id}", params)
else
puts " #{@name}: Uploading #{filename}"
data = File.open("#{@plugin_dir}/#{filename}") { |f| f.read }
data = File.open("#{@plugin_dir}/#{filename}", "rb") { |f| f.read }
hash = action
# Minimise file before uploading?
if @options.minimiser != nil && filename =~ /\A(static|template)\//
Expand Down

0 comments on commit 8ff1f0b

Please sign in to comment.