Skip to content

Commit

Permalink
fix: 解决网站配置文件生成错误问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengkunwang223 committed Jun 26, 2024
1 parent 88f19b7 commit 174d60e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/app/service/website.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ func (w WebsiteService) CreateWebsiteDomain(create request.WebsiteDomainCreate)
for _, domain := range domainModels {
wafSite.Domains = append(wafSite.Domains, domain.Domain)
if domain.Port != 80 && domain.Port != 443 {
wafSite.Host = append(wafSite.Host, domain.Domain+":"+string(rune(domain.Port)))
wafSite.Host = append(wafSite.Host, domain.Domain+":"+strconv.Itoa(domain.Port))
}
}
if len(wafSite.Host) == 0 {
Expand Down Expand Up @@ -619,7 +619,7 @@ func (w WebsiteService) DeleteWebsiteDomain(domainId uint) error {
oldHostArray := wafSite.Host
var newHostArray []string
for _, host := range oldHostArray {
if host == webSiteDomain.Domain+":"+string(rune(webSiteDomain.Port)) {
if host == webSiteDomain.Domain+":"+strconv.Itoa(webSiteDomain.Port) {
continue
}
newHostArray = append(newHostArray, host)
Expand Down
2 changes: 1 addition & 1 deletion backend/app/service/website_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func createWafConfig(website *model.Website, domains []model.WebsiteDomain) erro

for _, domain := range domains {
wafWebsite.Domains = append(wafWebsite.Domains, domain.Domain)
wafWebsite.Host = append(wafWebsite.Host, domain.Domain+":"+string(rune(domain.Port)))
wafWebsite.Host = append(wafWebsite.Host, domain.Domain+":"+strconv.Itoa(domain.Port))
}
websitesArray = append(websitesArray, wafWebsite)
websitesContent, err := json.Marshal(websitesArray)
Expand Down

0 comments on commit 174d60e

Please sign in to comment.