Merge pull request #1353 from okriuchykhin/ok_SCI_2771

Fix API endpoints that return file URLs [SCI-2771]
This commit is contained in:
Alex Kriuchykhin 2018-10-29 13:44:55 +01:00 committed by GitHub
commit 4320af794b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View file

@ -18,7 +18,7 @@ module Api
end
def url
if !object.asset&.file_present
if !object.asset&.file&.exists?
nil
elsif object.asset&.file&.is_stored_on_s3?
object.asset.presigned_url(download: true)

View file

@ -19,14 +19,12 @@ module Api
end
def url
if !object.asset&.file_present
if !object.asset&.file&.exists?
nil
elsif object.asset&.file&.is_stored_on_s3?
object.asset.presigned_url(download: true)
else
# TODO
# separate api endpoint for local files download is needed
'url'#download_asset_path(object.asset.id)
object.asset.file.url
end
end
end