fix: f3: label color must start with #

This commit is contained in:
limiting-factor 2024-09-15 10:39:33 +02:00 committed by Earl Warren
parent 63204e8edf
commit 604c21ffd7
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -7,6 +7,7 @@ package driver
import ( import (
"context" "context"
"fmt" "fmt"
"strings"
"code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/db"
issues_model "code.gitea.io/gitea/models/issues" issues_model "code.gitea.io/gitea/models/issues"
@ -45,7 +46,7 @@ func (o *label) ToFormat() f3.Interface {
return &f3.Label{ return &f3.Label{
Common: f3.NewCommon(fmt.Sprintf("%d", o.forgejoLabel.ID)), Common: f3.NewCommon(fmt.Sprintf("%d", o.forgejoLabel.ID)),
Name: o.forgejoLabel.Name, Name: o.forgejoLabel.Name,
Color: o.forgejoLabel.Color, Color: strings.TrimPrefix(o.forgejoLabel.Color, "#"),
Description: o.forgejoLabel.Description, Description: o.forgejoLabel.Description,
} }
} }
@ -56,7 +57,7 @@ func (o *label) FromFormat(content f3.Interface) {
ID: f3_util.ParseInt(label.GetID()), ID: f3_util.ParseInt(label.GetID()),
Name: label.Name, Name: label.Name,
Description: label.Description, Description: label.Description,
Color: label.Color, Color: "#" + label.Color,
} }
} }