mirror of
https://github.com/go-gitea/gitea
synced 2024-10-19 20:10:10 +02:00
improve initClassifier
This commit is contained in:
parent
13867800c5
commit
c5296f449c
@ -67,18 +67,18 @@ func initClassifier() error {
|
||||
return err
|
||||
}
|
||||
|
||||
licenseNameCount := make(map[string]int)
|
||||
existLicense := make(container.Set[string])
|
||||
if len(licenseFiles) > 0 {
|
||||
for _, licenseFile := range licenseFiles {
|
||||
licenseName := ConvertLicenseName(licenseFile)
|
||||
if existLicense.Contains(licenseName) {
|
||||
continue
|
||||
}
|
||||
existLicense.Add(licenseName)
|
||||
data, err := options.License(licenseFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
licenseName := ConvertLicenseName(licenseFile)
|
||||
licenseNameCount[licenseName]++
|
||||
if licenseNameCount[licenseName] > 1 {
|
||||
continue
|
||||
}
|
||||
classifier.AddContent("License", licenseFile, licenseName, data)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user