mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-08 18:04:14 +01:00
API: Return error when Mirrors globaly disabled and like to create one (#11757)
* API: return an error when Mirrors globaly disabled * keep it consistent with UI Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
b534a5164f
commit
0cb22121f4
1 changed files with 5 additions and 1 deletions
|
@ -113,12 +113,16 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
|
||||||
gitServiceType = api.GithubService
|
gitServiceType = api.GithubService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if form.Mirror && setting.Repository.DisableMirrors {
|
||||||
|
ctx.Error(http.StatusForbidden, "MirrorsGlobalDisabled", fmt.Errorf("the site administrator has disabled mirrors"))
|
||||||
|
}
|
||||||
|
|
||||||
var opts = migrations.MigrateOptions{
|
var opts = migrations.MigrateOptions{
|
||||||
CloneAddr: remoteAddr,
|
CloneAddr: remoteAddr,
|
||||||
RepoName: form.RepoName,
|
RepoName: form.RepoName,
|
||||||
Description: form.Description,
|
Description: form.Description,
|
||||||
Private: form.Private || setting.Repository.ForcePrivate,
|
Private: form.Private || setting.Repository.ForcePrivate,
|
||||||
Mirror: form.Mirror && !setting.Repository.DisableMirrors,
|
Mirror: form.Mirror,
|
||||||
AuthUsername: form.AuthUsername,
|
AuthUsername: form.AuthUsername,
|
||||||
AuthPassword: form.AuthPassword,
|
AuthPassword: form.AuthPassword,
|
||||||
Wiki: form.Wiki,
|
Wiki: form.Wiki,
|
||||||
|
|
Loading…
Reference in a new issue