mirror of
https://github.com/go-gitea/gitea
synced 2025-01-19 06:04:26 +00:00
Fix 500 error when error occurred in migration page (#33256)
The template should be `repo/migrate/{service type}` But input element `service` is not in the form. Related: #33081 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
4672ddcdd7
commit
3a749fc816
@ -3,13 +3,15 @@
|
|||||||
<div class="ui container medium-width">
|
<div class="ui container medium-width">
|
||||||
<h3 class="ui top attached header">
|
<h3 class="ui top attached header">
|
||||||
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
||||||
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
||||||
{{template "base/disable_form_autofill"}}
|
{{template "base/disable_form_autofill"}}
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
|
||||||
|
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
||||||
|
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
|
@ -3,13 +3,15 @@
|
|||||||
<div class="ui container medium-width">
|
<div class="ui container medium-width">
|
||||||
<h3 class="ui top attached header">
|
<h3 class="ui top attached header">
|
||||||
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
||||||
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
||||||
{{template "base/disable_form_autofill"}}
|
{{template "base/disable_form_autofill"}}
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
|
||||||
|
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
||||||
|
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
|
@ -3,13 +3,15 @@
|
|||||||
<div class="ui container medium-width">
|
<div class="ui container medium-width">
|
||||||
<h3 class="ui top attached header">
|
<h3 class="ui top attached header">
|
||||||
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
||||||
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
||||||
{{template "base/disable_form_autofill"}}
|
{{template "base/disable_form_autofill"}}
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
|
||||||
|
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
||||||
|
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
|
@ -3,13 +3,15 @@
|
|||||||
<div class="ui container medium-width">
|
<div class="ui container medium-width">
|
||||||
<h3 class="ui top attached header">
|
<h3 class="ui top attached header">
|
||||||
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
||||||
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
||||||
{{template "base/disable_form_autofill"}}
|
{{template "base/disable_form_autofill"}}
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
|
||||||
|
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
||||||
|
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
<div class="ui container medium-width">
|
<div class="ui container medium-width">
|
||||||
<h3 class="ui top attached header">
|
<h3 class="ui top attached header">
|
||||||
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
||||||
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
|
||||||
|
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
||||||
|
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
<div class="ui container medium-width">
|
<div class="ui container medium-width">
|
||||||
<h3 class="ui top attached header">
|
<h3 class="ui top attached header">
|
||||||
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
||||||
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
|
||||||
|
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
||||||
|
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
<div class="ui container medium-width">
|
<div class="ui container medium-width">
|
||||||
<h3 class="ui top attached header">
|
<h3 class="ui top attached header">
|
||||||
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
||||||
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
|
||||||
|
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
||||||
|
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
<div class="ui container medium-width">
|
<div class="ui container medium-width">
|
||||||
<h3 class="ui top attached header">
|
<h3 class="ui top attached header">
|
||||||
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
||||||
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
|
||||||
|
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
||||||
|
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
|
@ -3,13 +3,15 @@
|
|||||||
<div class="ui container medium-width">
|
<div class="ui container medium-width">
|
||||||
<h3 class="ui top attached header">
|
<h3 class="ui top attached header">
|
||||||
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
{{ctx.Locale.Tr "repo.migrate.migrate" .service.Title}}
|
||||||
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="ui attached segment">
|
<div class="ui attached segment">
|
||||||
{{template "base/alert" .}}
|
{{template "base/alert" .}}
|
||||||
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
<form class="ui form left-right-form" action="{{.Link}}" method="post">
|
||||||
{{template "base/disable_form_autofill"}}
|
{{template "base/disable_form_autofill"}}
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
|
|
||||||
|
<input id="service_type" type="hidden" name="service" value="{{.service}}">
|
||||||
|
|
||||||
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
<div class="inline required field {{if .Err_CloneAddr}}error{{end}}">
|
||||||
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
<label for="clone_addr">{{ctx.Locale.Tr "repo.migrate.clone_address"}}</label>
|
||||||
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
<input id="clone_addr" name="clone_addr" value="{{.clone_addr}}" autofocus required>
|
||||||
|
@ -79,8 +79,12 @@ func TestMigrateGiteaForm(t *testing.T) {
|
|||||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||||
// Step 2: load the form
|
// Step 2: load the form
|
||||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
link, exists := htmlDoc.doc.Find(`form.ui.form[action^="/repo/migrate"]`).Attr("action")
|
form := htmlDoc.doc.Find(`form.ui.form[action^="/repo/migrate"]`)
|
||||||
|
link, exists := form.Attr("action")
|
||||||
assert.True(t, exists, "The template has changed")
|
assert.True(t, exists, "The template has changed")
|
||||||
|
serviceInput, exists := form.Find(`input[name="service"]`).Attr("value")
|
||||||
|
assert.True(t, exists)
|
||||||
|
assert.EqualValues(t, fmt.Sprintf("%d", structs.GiteaService), serviceInput)
|
||||||
// Step 4: submit the migration to only migrate issues
|
// Step 4: submit the migration to only migrate issues
|
||||||
migratedRepoName := "otherrepo"
|
migratedRepoName := "otherrepo"
|
||||||
req = NewRequestWithValues(t, "POST", link, map[string]string{
|
req = NewRequestWithValues(t, "POST", link, map[string]string{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user