fix: 修复域名删除导致网站访问被 WAF 拦截的问题 (#6337)
Some checks failed
Build Test / build-linux-binary (push) Failing after -8m33s
Build / SonarCloud (push) Failing after -8m35s
sync2gitee / repo-sync (push) Failing after -8m36s

Refs https://github.com/1Panel-dev/1Panel/issues/6336
This commit is contained in:
zhengkunwang 2024-09-02 18:23:37 +08:00 committed by GitHub
parent cf8aa86a67
commit 051f670453
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -641,8 +641,10 @@ func (w WebsiteService) DeleteWebsiteDomain(domainId uint) error {
wafSite := wafWebsite
oldDomains := wafSite.Domains
var newDomains []string
removed := false
for _, domain := range oldDomains {
if domain == webSiteDomain.Domain {
if domain == webSiteDomain.Domain && !removed {
removed = true
continue
}
newDomains = append(newDomains, domain)