git-svn-id: https://svn.redmine.org/redmine/trunk@21694 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/5.1.0
@@ -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 = "" |