mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Local storage: Always try to create directories, handle already existing.
This reduces the chances of races where two client try to upload the same file.
This commit is contained in:
parent
1c96d0cabd
commit
d3804d5142
1 changed files with 3 additions and 1 deletions
|
@ -95,8 +95,10 @@ module Fog
|
|||
next
|
||||
end
|
||||
# create directory if it doesn't already exist
|
||||
unless ::File.directory?(dir_path)
|
||||
begin
|
||||
Dir.mkdir(dir_path)
|
||||
rescue Errno::EEXIST
|
||||
raise unless ::File.directory?(dir_path)
|
||||
end
|
||||
end
|
||||
file = ::File.new(path, 'wb')
|
||||
|
|
Loading…
Reference in a new issue