[#42160] fixed service code, satisfy tests

pull/10834/head
Eric Schubert 2 years ago
parent 9e7a2ea415
commit a00d9cb79c
No known key found for this signature in database
GPG Key ID: 1D346C019BD4BAA2
  1. 6
      modules/storages/lib/api/v3/file_links/storage_url_helper.rb

@ -53,12 +53,14 @@ module API::V3::FileLinks::StorageUrlHelper
token = parse_direct_download_token body: response.result
if token.blank?
Rails.logger.error "Received unexpected json response: #{response.result.body}"
Rails.logger.error "Received unexpected json response: #{response.result}"
return ServiceResult.failure(result: I18n.t('http.response.unexpected'))
end
"#{storage.host}/apps/integration_openproject/direct?token=#{token}&fileName=#{file_link.origin_name}"
url = "#{storage.host}/apps/integration_openproject/direct?token=#{token}&fileName=#{file_link.origin_name}"
ServiceResult.success(result: url)
end
# rubocop:enable Metrics/AbcSize
private

Loading…
Cancel
Save