新增: filepath特殊字符处理
This commit is contained in:
		
							parent
							
								
									c00d885e53
								
							
						
					
					
						commit
						96a70007fd
					
				| 
						 | 
					@ -12,7 +12,7 @@ class Api::V1::Projects::CommitsController < Api::V1::BaseController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def files 
 | 
					  def files 
 | 
				
			||||||
    if params[:filepath].present? 
 | 
					    if params[:filepath].present? 
 | 
				
			||||||
      @result_object = $gitea_hat_client.get_repos_commits_files_by_owner_repo_sha_filepath(@project&.owner.login, @project&.identifier, params[:sha], params[:filepath], {query: {token: current_user&.gitea_token}})
 | 
					      @result_object = $gitea_hat_client.get_repos_commits_files_by_owner_repo_sha_filepath(@project&.owner.login, @project&.identifier, params[:sha], CGI.escape(params[:filepath]), {query: {token: current_user&.gitea_token}})
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      @result_object = $gitea_hat_client.get_repos_commits_files_by_owner_repo_sha(@project&.owner.login, @project&.identifier, params[:sha], {query: {token: current_user&.gitea_token, page: page, limit: limit}})
 | 
					      @result_object = $gitea_hat_client.get_repos_commits_files_by_owner_repo_sha(@project&.owner.login, @project&.identifier, params[:sha], {query: {token: current_user&.gitea_token, page: page, limit: limit}})
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ class Api::V1::Projects::CompareController < Api::V1::BaseController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def gitea_compare_files(base, head)
 | 
					  def gitea_compare_files(base, head)
 | 
				
			||||||
    if params[:filepath].present?
 | 
					    if params[:filepath].present?
 | 
				
			||||||
      $gitea_hat_client.get_repos_compare_files_by_owner_repo_baseref_headref_filepath(@project&.owner&.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), params[:filepath], {query: {token: current_user&.gitea_token}})
 | 
					      $gitea_hat_client.get_repos_compare_files_by_owner_repo_baseref_headref_filepath(@project&.owner&.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), CGI.escape(params[:filepath]), {query: {token: current_user&.gitea_token}})
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      $gitea_hat_client.get_repos_compare_files_by_owner_repo_baseref_headref(@project&.owner&.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), {query: {page:page,limit:limit,token: current_user&.gitea_token}})
 | 
					      $gitea_hat_client.get_repos_compare_files_by_owner_repo_baseref_headref(@project&.owner&.login, @project.identifier, Addressable::URI.escape(base), Addressable::URI.escape(head), {query: {page:page,limit:limit,token: current_user&.gitea_token}})
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,7 @@ class Api::V1::Projects::Pulls::PullsController < Api::V1::BaseController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def files
 | 
					  def files
 | 
				
			||||||
    if params[:filepath].present? 
 | 
					    if params[:filepath].present? 
 | 
				
			||||||
      @result_object = $gitea_hat_client.get_repos_pulls_files_by_owner_repo_index_filepath(@project&.owner.login, @project&.identifier, @pull_request.gitea_number, params[:filepath], {query: {token: current_user&.gitea_token}})
 | 
					      @result_object = $gitea_hat_client.get_repos_pulls_files_by_owner_repo_index_filepath(@project&.owner.login, @project&.identifier, @pull_request.gitea_number, CGI.escape(params[:filepath]), {query: {token: current_user&.gitea_token}})
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      @result_object = $gitea_hat_client.get_repos_pulls_files_by_owner_repo_index(@project&.owner.login, @project&.identifier, @pull_request.gitea_number, {query: {isNew: "true",token: current_user&.gitea_token, page: page, limit: limit}})
 | 
					      @result_object = $gitea_hat_client.get_repos_pulls_files_by_owner_repo_index(@project&.owner.login, @project&.identifier, @pull_request.gitea_number, {query: {isNew: "true",token: current_user&.gitea_token, page: page, limit: limit}})
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue