mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-23 15:41:36 +00:00
Improve forge authorization error message for invalid tokens.
Before:
- not authorized by forge (wildcard)
- cannot check repository permissions: GET https://codeberg.org/api/v1/repos/whitequark/whitequark.codeberg.page returned 401 Unauthorized
After:
- not authorized by forge (wildcard)
- no access to whitequark/whitequark.codeberg.page or invalid token
This commit is contained in:
@@ -578,6 +578,11 @@ func checkGogsRepositoryPushPermission(baseURL *url.URL, authorization string) e
|
||||
http.StatusNotFound,
|
||||
fmt.Sprintf("no repository %s", ownerAndRepo),
|
||||
}
|
||||
} else if response.StatusCode == http.StatusUnauthorized {
|
||||
return AuthError{
|
||||
http.StatusUnauthorized,
|
||||
fmt.Sprintf("no access to %s or invalid token", ownerAndRepo),
|
||||
}
|
||||
} else if response.StatusCode != http.StatusOK {
|
||||
return AuthError{
|
||||
http.StatusServiceUnavailable,
|
||||
|
||||
Reference in New Issue
Block a user