1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 11:37:14 +00:00

Fixes for Style/FileWrite offense introduced in RuboCop 1.24.0 (#35136).

git-svn-id: http://svn.redmine.org/redmine/trunk@21322 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2021-12-24 05:30:56 +00:00
parent 04d0a0a259
commit 531144e6dd
3 changed files with 3 additions and 7 deletions

View File

@ -114,7 +114,7 @@ module DeliveryMethods
dest_dir = File.join(Rails.root, 'tmp', 'emails')
Dir.mkdir(dest_dir) unless File.directory?(dest_dir)
filename = "#{Time.now.to_i}_#{mail.message_id.gsub(/[<>]/, '')}.eml"
File.open(File.join(dest_dir, filename), 'wb') {|f| f.write(mail.encoded) }
File.binwrite(File.join(dest_dir, filename), mail.encoded)
end
end
end

View File

@ -375,9 +375,7 @@ module Redmine
def save_pdf
assert_equal 'application/pdf', response.media_type
filename = "#{self.class.name.underscore}__#{method_name}.pdf"
File.open(File.join($redmine_tmp_pdf_directory, filename), "wb") do |f|
f.write response.body
end
File.binwrite(File.join($redmine_tmp_pdf_directory, filename), response.body)
end
end

View File

@ -362,9 +362,7 @@ class AttachmentTest < ActiveSupport::TestCase
a = Attachment.find(20)
assert a.disk_directory.blank?
# Create a real file for this fixture
File.open(a.diskfile, "w") do |f|
f.write "test file at the root of files directory"
end
File.write(a.diskfile, 'test file at the root of files directory')
assert a.readable?
Attachment.move_from_root_to_target_directory