mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Changed Atmos::FIle.public_url so checks for existence of the file on storage on every call to the method minimising the potential for a 404 error
This commit is contained in:
parent
cbc78a22a8
commit
b6e4d81d7c
1 changed files with 2 additions and 5 deletions
|
@ -57,11 +57,8 @@ module Fog
|
|||
|
||||
# By default, expire in 5 years
|
||||
def public_url(expires = (Time.now + 5 * 365 * 24 * 60 * 60))
|
||||
if self.objectid.blank?
|
||||
file = directory.files.head(key)
|
||||
self.objectid = file.attributes['x-emc-meta'].scan(/objectid=(\w+),/).flatten[0] if file.present?
|
||||
end
|
||||
|
||||
file = directory.files.head(key)
|
||||
self.objectid = if file.present? then file.attributes['x-emc-meta'].scan(/objectid=(\w+),/).flatten[0] else nil end
|
||||
if self.objectid.present?
|
||||
uri = URI::HTTP.build(:scheme => connection.ssl? ? "http" : "https" , :host => connection.host, :port => connection.port.to_i, :path => "/rest/objects/#{self.objectid}" )
|
||||
|
||||
|
|
Loading…
Reference in a new issue