更改:下载文件以及查看文件逻辑

This commit is contained in:
2023-04-12 14:51:27 +08:00
parent ccede16716
commit 0830850518
5 changed files with 19 additions and 15 deletions

View File

@@ -273,7 +273,7 @@ class RepositoriesController < ApplicationController
domain = GiteaService.gitea_config[:domain]
api_url = GiteaService.gitea_config[:base_url]
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{Addressable::URI.escape(params[:filepath])}?ref=#{Addressable::URI.escape(params[:ref])}"
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{CGI.escape(params[:filepath])}?ref=#{CGI.escape(params[:ref])}"
file_path = [domain, api_url, url].join
file_path = [file_path, "access_token=#{@owner&.gitea_token}"].join("&")