Skip to content

Commit

Permalink
Merge pull request #37 from shlomizadok/fix_15388
Browse files Browse the repository at this point in the history
Fixes #15388 - Use File.size class method instead of instance method
  • Loading branch information
shlomizadok committed Jun 16, 2016
2 parents 29a9daf + d378c1e commit 7a77027
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/smart_proxy_openscap/storage_fs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def get_arf_html(digest)
xml = get_arf_file(digest)[:xml]
size = get_arf_file(digest)[:size]
arf_object = OpenSCAP::DS::Arf.new(:content => xml, :path => 'arf.xml.bz2', :length => size)
# @TODO: Drop this when support for 1.8.7 ends
return arf_object.html if RUBY_VERSION.start_with? '1.8'
arf_object.html.force_encoding('UTF-8')
end

Expand Down Expand Up @@ -72,7 +74,7 @@ def get_arf_file(digest)
full_path = @path + digest
raise FileNotFound, "Can't find path #{full_path}" if !File.file?(full_path) || File.zero?(full_path)
file = File.open(full_path)
{ :size => file.size, :xml => file.read }
{ :size => File.size(file), :xml => file.read }
end
end
end

0 comments on commit 7a77027

Please sign in to comment.