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:
Luke GB 2015-07-12 14:14:12 +01:00
parent 0f9d2d2d96
commit acc05dd3a5
1 changed files with 1 additions and 1 deletions

View File

@ -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