From acc05dd3a5f3b2520b4a67da281be17bca72310f Mon Sep 17 00:00:00 2001 From: Luke GB Date: Sun, 12 Jul 2015 14:14:12 +0100 Subject: [PATCH] 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. --- lib/file_store/local_store.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/file_store/local_store.rb b/lib/file_store/local_store.rb index b5c172eeeb7..53a20df3895 100644 --- a/lib/file_store/local_store.rb +++ b/lib/file_store/local_store.rb @@ -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