mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-21 12:55:23 +02:00
fix: split and trim labels
This commit is contained in:
parent
05c08ec246
commit
4bc6d73b1d
@ -130,7 +130,7 @@ func RunnerDetailsEditPost(ctx *context.Context, runnerID, ownerID, repoID int64
|
|||||||
|
|
||||||
form := web.GetForm(ctx).(*forms.EditRunnerForm)
|
form := web.GetForm(ctx).(*forms.EditRunnerForm)
|
||||||
runner.Description = form.Description
|
runner.Description = form.Description
|
||||||
runner.CustomLabels = strings.Split(form.CustomLabels, ",")
|
runner.CustomLabels = splitLabels(form.CustomLabels)
|
||||||
|
|
||||||
err = actions_model.UpdateRunner(ctx, runner, "description", "custom_labels")
|
err = actions_model.UpdateRunner(ctx, runner, "description", "custom_labels")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -182,3 +182,11 @@ func RunnerDeletePost(ctx *context.Context, runnerID int64,
|
|||||||
ctx.Flash.Success(ctx.Tr("runners.delete_runner_success"))
|
ctx.Flash.Success(ctx.Tr("runners.delete_runner_success"))
|
||||||
ctx.Redirect(successRedirectTo)
|
ctx.Redirect(successRedirectTo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func splitLabels(s string) []string {
|
||||||
|
labels := strings.Split(s, ",")
|
||||||
|
for i, v := range labels {
|
||||||
|
labels[i] = strings.TrimSpace(v)
|
||||||
|
}
|
||||||
|
return labels
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user