mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:03:43 +08:00
Fix LocalStore.remove_file to not raise if source doesn't exist
FileUtils.move actually ends up raising an "unknown file type" error if the file doesn't exist instead of Errno::ENOENT. It's possible to rescue this, but in the end it's easier to just ask move not to throw an error, since we're going to throw it away anyway.
This commit is contained in:
parent
0f9d2d2d96
commit
acc05dd3a5
|
@ -14,7 +14,7 @@ module FileStore
|
|||
path = public_dir + url
|
||||
tombstone = public_dir + url.sub("/uploads/", "/tombstone/")
|
||||
FileUtils.mkdir_p(Pathname.new(tombstone).dirname)
|
||||
FileUtils.move(path, tombstone)
|
||||
FileUtils.move(path, tombstone, :force => true)
|
||||
rescue Errno::ENOENT
|
||||
# don't care if the file isn't there
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user