Commit 6d590da3 by Ivan

fix: URI.join 导出的 文件 url

parent cd769e78
...@@ -281,7 +281,7 @@ module TalltyImportExport ...@@ -281,7 +281,7 @@ module TalltyImportExport
when 'file' when 'file'
if data.is_a?(Array) && !opts[:keep_array] if data.is_a?(Array) && !opts[:keep_array]
data.map do |item| data.map do |item|
url = item.dig('url') || (item.dig('downloadPath') ? [ENV['SOA_FILE_DOWNLOAD_HOST'], item.dig('downloadPath')].join : nil) url = item.dig('url') || (item.dig('downloadPath') ? URI.join(ENV['SOA_FILE_DOWNLOAD_HOST'], item.dig('downloadPath')) : nil)
url.present? ? url.present? ?
"#{url}?fileName=#{URI.encode_www_form_component(item.dig('fileName'))}&fileSize=#{URI.encode_www_form_component(item.dig('fileSize'))}&mimeType=#{URI.encode_www_form_component(item.dig('mimeType') || item.dig('fileType'))}" : "#{url}?fileName=#{URI.encode_www_form_component(item.dig('fileName'))}&fileSize=#{URI.encode_www_form_component(item.dig('fileSize'))}&mimeType=#{URI.encode_www_form_component(item.dig('mimeType') || item.dig('fileType'))}" :
nil nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment