mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-11 15:25:56 +08:00
下载文件链接encode
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user