fix: some error for read raw data

This commit is contained in:
yystopf 2021-12-21 15:14:10 +08:00
parent 45a77e5c07
commit df69dee282
2 changed files with 3 additions and 1 deletions

View File

@ -254,7 +254,7 @@ class RepositoriesController < ApplicationController
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{params[:filepath]}?ref=#{params[:ref]}" url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{params[:filepath]}?ref=#{params[:ref]}"
file_path = [domain, api_url, url].join file_path = [domain, api_url, url].join
file_path = [file_path, "access_token=#{current_user&.gitea_token}"].join("&") if @repository.hidden? file_path = [file_path, "access_token=#{current_user&.gitea_token}"].join("&")
redirect_to URI.escape(file_path) redirect_to URI.escape(file_path)
end end

View File

@ -68,6 +68,8 @@ module RepositoriesHelper
# else # else
# new_r_content = r_content + "?raw=true" # new_r_content = r_content + "?raw=true"
# end # end
new_r_content = r_content
unless r_content.include?("http://") || r_content.include?("https://") || r_content.include?("mailto:") unless r_content.include?("http://") || r_content.include?("https://") || r_content.include?("mailto:")
# new_r_content = "#{path}" + new_r_content # new_r_content = "#{path}" + new_r_content
new_r_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw?filepath=#{r_content}&ref=#{ref}"].join new_r_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw?filepath=#{r_content}&ref=#{ref}"].join