fix
This commit is contained in:
parent
05c3f60dab
commit
64423f1999
|
@ -26,11 +26,11 @@ POST accounts/remote_register
|
||||||
*示例*
|
*示例*
|
||||||
```bash
|
```bash
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
-d "email=2456233122@qq.com" \
|
-d "email=test77@forge.com" \
|
||||||
-d "password=djs_D_00001" \
|
-d "password=123456" \
|
||||||
-d "username=16895620" \
|
-d "username=testforge77" \
|
||||||
-d "platform=forge" \
|
-d "platform=forge" \
|
||||||
http://localhost:3000/api/accounts/remote_register | jq
|
https://testforgeplus.trustie.net/api/accounts/remote_register | jq
|
||||||
```
|
```
|
||||||
*请求参数说明:*
|
*请求参数说明:*
|
||||||
|
|
||||||
|
|
|
@ -238,25 +238,25 @@ class RepositoriesController < ApplicationController
|
||||||
def archive
|
def archive
|
||||||
domain = Gitea.gitea_config[:domain]
|
domain = Gitea.gitea_config[:domain]
|
||||||
api_url = Gitea.gitea_config[:base_url]
|
api_url = Gitea.gitea_config[:base_url]
|
||||||
archive_url = "/repos/#{@owner.login}/#{@repository.identifier}/archive/#{params[:archive]}"
|
archive_url = "/repos/#{@owner.login}/#{@repository.identifier}/archive/#{CGI.escape(params[:archive])}"
|
||||||
|
|
||||||
file_path = [domain, api_url, archive_url].join
|
file_path = [domain, api_url, archive_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("?") if @repository.hidden?
|
||||||
|
|
||||||
return render_not_found if !request.format.zip? && !request.format.gzip?
|
return render_not_found if !request.format.zip? && !request.format.gzip?
|
||||||
|
|
||||||
redirect_to URI.escape(file_path)
|
redirect_to file_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw
|
def raw
|
||||||
domain = Gitea.gitea_config[:domain]
|
domain = Gitea.gitea_config[:domain]
|
||||||
api_url = Gitea.gitea_config[:base_url]
|
api_url = Gitea.gitea_config[:base_url]
|
||||||
|
|
||||||
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{params[:filepath]}?ref=#{params[:ref]}"
|
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{params[:filepath]}?ref=#{CGI.escapte(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("&")
|
file_path = [file_path, "access_token=#{current_user&.gitea_token}"].join("&")
|
||||||
|
|
||||||
redirect_to URI.escape(file_path)
|
redirect_to file_path
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue