This commit is contained in:
WJQSERVER 2024-10-05 23:21:10 +08:00
parent ee215eff36
commit 1d7780a890

View file

@ -38,6 +38,14 @@ func IsBlacklisted(username, repo string, blacklist map[string][]string, enabled
if !enabled { if !enabled {
return false return false
} }
// 检查 blacklist 是否为 nil
if blacklist == nil {
// 可以选择记录日志或返回 false
logw("Warning: Blacklist map is nil")
return false
}
if repos, ok := blacklist[username]; ok { if repos, ok := blacklist[username]; ok {
for _, blacklistedRepo := range repos { for _, blacklistedRepo := range repos {
if blacklistedRepo == repo { if blacklistedRepo == repo {
@ -45,5 +53,6 @@ func IsBlacklisted(username, repo string, blacklist map[string][]string, enabled
} }
} }
} }
return false return false
} }