mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: Check if file exists upfront.
This commit is contained in:
parent
64e59564dd
commit
26084397c1
1 changed files with 1 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue