mirror of
https://github.com/redmine/redmine.git
synced 2025-10-26 07:46:17 +01:00
Fix RuboCop offense Lint/NonAtomicFileOperation (#36919).
git-svn-id: https://svn.redmine.org/redmine/trunk@21694 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -525,9 +525,7 @@ class Attachment < ActiveRecord::Base
|
||||
|
||||
# Physically deletes the file from the file system
|
||||
def delete_from_disk!
|
||||
if disk_filename.present? && File.exist?(diskfile)
|
||||
File.delete(diskfile)
|
||||
end
|
||||
FileUtils.rm_f(diskfile) if disk_filename.present?
|
||||
Dir[thumbnail_path("*")].each do |thumb|
|
||||
File.delete(thumb)
|
||||
end
|
||||
|
||||
@@ -43,9 +43,7 @@ module Redmine
|
||||
return nil if is_pdf && mime_type != "application/pdf"
|
||||
|
||||
directory = File.dirname(target)
|
||||
unless File.exist?(directory)
|
||||
FileUtils.mkdir_p directory
|
||||
end
|
||||
FileUtils.mkdir_p directory
|
||||
size_option = "#{size}x#{size}>"
|
||||
|
||||
if is_pdf
|
||||
|
||||
@@ -51,9 +51,7 @@ module Redmine
|
||||
|
||||
def save_upload(upload, path)
|
||||
directory = File.dirname(path)
|
||||
unless File.exist?(directory)
|
||||
FileUtils.mkdir_p directory
|
||||
end
|
||||
FileUtils.mkdir_p directory
|
||||
File.open(path, "wb") do |f|
|
||||
if upload.respond_to?(:read)
|
||||
buffer = ""
|
||||
|
||||
Reference in New Issue
Block a user