From 26084397c1219040dc9d8810e73d985b53dd80c6 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 23 May 2016 10:25:25 +0800 Subject: [PATCH] FIX: Check if file exists upfront. --- lib/file_store/local_store.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/file_store/local_store.rb b/lib/file_store/local_store.rb index a4068e57d12..e9bbdab6a1f 100644 --- a/lib/file_store/local_store.rb +++ b/lib/file_store/local_store.rb @@ -12,11 +12,10 @@ module FileStore def remove_file(url) return unless is_relative?(url) path = public_dir + url + return if !File.exists?(path) tombstone = public_dir + url.sub("/uploads/", "/tombstone/") FileUtils.mkdir_p(Pathname.new(tombstone).dirname) FileUtils.move(path, tombstone, :force => true) - rescue Errno::ENOENT - # don't care if the file isn't there end def has_been_uploaded?(url)