mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-30 21:45:41 +08:00
parent
2bd7feed37
commit
e1ed2a76b1
|
@ -241,6 +241,19 @@ func (g *GitlabDownloader) GetMilestones() ([]*base.Milestone, error) {
|
||||||
return milestones, nil
|
return milestones, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *GitlabDownloader) normalizeColor(val string) string {
|
||||||
|
val = strings.TrimLeft(val, "#")
|
||||||
|
val = strings.ToLower(val)
|
||||||
|
if len(val) == 3 {
|
||||||
|
c := []rune(val)
|
||||||
|
val = fmt.Sprintf("%c%c%c%c%c%c", c[0], c[0], c[1], c[1], c[2], c[2])
|
||||||
|
}
|
||||||
|
if len(val) != 6 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
// GetLabels returns labels
|
// GetLabels returns labels
|
||||||
func (g *GitlabDownloader) GetLabels() ([]*base.Label, error) {
|
func (g *GitlabDownloader) GetLabels() ([]*base.Label, error) {
|
||||||
if g == nil {
|
if g == nil {
|
||||||
|
@ -259,7 +272,7 @@ func (g *GitlabDownloader) GetLabels() ([]*base.Label, error) {
|
||||||
for _, label := range ls {
|
for _, label := range ls {
|
||||||
baseLabel := &base.Label{
|
baseLabel := &base.Label{
|
||||||
Name: label.Name,
|
Name: label.Name,
|
||||||
Color: strings.TrimLeft(label.Color, "#)"),
|
Color: g.normalizeColor(label.Color),
|
||||||
Description: label.Description,
|
Description: label.Description,
|
||||||
}
|
}
|
||||||
labels = append(labels, baseLabel)
|
labels = append(labels, baseLabel)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user