下载文件链接encode
This commit is contained in:
parent
ff53e15b31
commit
64e85397f3
|
@ -40,10 +40,10 @@ class AttachmentsController < ApplicationController
|
|||
url.gsub!(url.split("/")[-1], '')
|
||||
puts filepath
|
||||
request_url = [domain, api_url, url, CGI.escape(filepath), "?ref=#{CGI.escape(ref.split('ref=')[1])}&access_token=#{User.where(admin: true).take&.gitea_token}"].join
|
||||
response = Faraday.get(request_url)
|
||||
response = Faraday.get(URI.encode(request_url))
|
||||
filename = filepath
|
||||
else
|
||||
response = Faraday.get(url)
|
||||
response = Faraday.get(URI.encode(url))
|
||||
filename = params[:download_url].to_s.split("/").pop()
|
||||
end
|
||||
send_data(response.body.force_encoding("UTF-8"), filename: filename, type: "application/octet-stream", disposition: 'attachment')
|
||||
|
|
Loading…
Reference in New Issue