mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 16:42:46 +08:00
FIX: Error when trying to move the same file to tombstone.
If an optimized image is destroyed when a previous similar optimized image is already placed in the tombstone, `FileUtils.move` will blow up.
This commit is contained in:
parent
01a3311ffb
commit
5b934cb33d
|
@ -16,6 +16,7 @@ module FileStore
|
|||
destination = "#{public_dir}#{url.sub("/uploads/", "/uploads/tombstone/")}"
|
||||
dir = Pathname.new(destination).dirname
|
||||
FileUtils.mkdir_p(dir) unless Dir.exists?(dir)
|
||||
FileUtils.remove(destination) if File.exists?(destination)
|
||||
FileUtils.move(source, destination, force: true)
|
||||
FileUtils.touch(destination)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user