From 64e85397f31631df94b5cf5f1bb40c81bd888d39 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 28 Jun 2023 11:14:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=E9=93=BE?= =?UTF-8?q?=E6=8E=A5encode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 0cdba3847..99346d2db 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -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')