Browse Source

fix

tags/v4.0.0^2
yystopf 4 years ago
parent
commit
64423f1999
2 changed files with 8 additions and 8 deletions
  1. +4
    -4
      api_document.md
  2. +4
    -4
      app/controllers/repositories_controller.rb

+ 4
- 4
api_document.md View File

@@ -26,11 +26,11 @@ POST accounts/remote_register
*示例*
```bash
curl -X POST \
-d "email=2456233122@qq.com" \
-d "password=djs_D_00001" \
-d "username=16895620" \
-d "email=test77@forge.com" \
-d "password=123456" \
-d "username=testforge77" \
-d "platform=forge" \
http://localhost:3000/api/accounts/remote_register | jq
https://testforgeplus.trustie.net/api/accounts/remote_register | jq
```
*请求参数说明:*



+ 4
- 4
app/controllers/repositories_controller.rb View File

@@ -238,25 +238,25 @@ class RepositoriesController < ApplicationController
def archive
domain = Gitea.gitea_config[:domain]
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 = [file_path, "access_token=#{current_user&.gitea_token}"].join("?") if @repository.hidden?
return render_not_found if !request.format.zip? && !request.format.gzip?
redirect_to URI.escape(file_path)
redirect_to file_path
end
def raw
domain = Gitea.gitea_config[:domain]
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 = [file_path, "access_token=#{current_user&.gitea_token}"].join("&")
redirect_to URI.escape(file_path)
redirect_to file_path
end
private


Loading…
Cancel
Save