mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-28 11:14:24 +08:00
Merge pull request #1353 from okriuchykhin/ok_SCI_2771
Fix API endpoints that return file URLs [SCI-2771]
This commit is contained in:
commit
4320af794b
2 changed files with 3 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue