|
|
|
@@ -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') |
|
|
|
|