Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API error cleanup #7186

Merged
merged 5 commits into from
Jun 12, 2019
Merged

API error cleanup #7186

merged 5 commits into from
Jun 12, 2019

Conversation

jolheiser
Copy link
Member

I removed base.DocURL completely because it shows up in Swagger errors and doesn't necessarily help with said errors.
It is a valuable link for users who create clients to interact with the Gitea API, however in the context of Swagger it's not entirely helpful in my opinion.

This PR adds settings.API.SwaggerURL which is simply the path to a given instance's base Swagger page and is used in any API error.

Replaced DocURL with SwaggerURL
Added error for fork already existing

Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
@@ -580,17 +582,17 @@ func NewContext() {
AppURL = strings.TrimRight(AppURL, "/") + "/"

// Check if has app suburl.
url, err := url.Parse(AppURL)
appURL, err := url.Parse(AppURL)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed url to appURL because url collides with the Go url package, and also to clarify the variable for use down below

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 12, 2019
@@ -899,6 +901,10 @@ func NewContext() {
log.Fatal("Failed to map Metrics settings: %v", err)
}

u := *appURL
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

De-referenced the pointer in case anyone uses appURL in a later change, since right below this I fudge the u.Path manually.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 12, 2019
@codecov-io
Copy link

Codecov Report

Merging #7186 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7186      +/-   ##
==========================================
+ Coverage   41.72%   41.73%   +<.01%     
==========================================
  Files         449      449              
  Lines       61129    61127       -2     
==========================================
+ Hits        25506    25511       +5     
+ Misses      32310    32302       -8     
- Partials     3313     3314       +1
Impacted Files Coverage Δ
modules/context/api.go 55.31% <100%> (+1.31%) ⬆️
modules/setting/setting.go 48.69% <100%> (+0.35%) ⬆️
models/gpg_key.go 55.83% <0%> (-0.84%) ⬇️
routers/repo/view.go 43.03% <0%> (+1.01%) ⬆️
models/unit.go 67.56% <0%> (+5.4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5832f8d...8d5dc29. Read the comment docs.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 12, 2019
@techknowlogick techknowlogick added this to the 1.9.0 milestone Jun 12, 2019
@techknowlogick techknowlogick merged commit 8f0182c into go-gitea:master Jun 12, 2019
@jolheiser jolheiser deleted the doc_url branch June 12, 2019 21:20
jeffliu27 pushed a commit to jeffliu27/gitea that referenced this pull request Jul 18, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants