更新网站功能
This commit is contained in:
@@ -136,7 +136,7 @@ func (c *TenantSiteController) rewriteStorageURLs(html string) string {
|
||||
if err != nil || strings.TrimSpace(cfg.QiniuDomain) == "" {
|
||||
return html
|
||||
}
|
||||
return rewriteLegacyQiniuURLs(html, storagePublicBaseURL(cfg.QiniuDomain))
|
||||
return rewriteLegacyQiniuURLs(html, storagePublicBaseURL(cfg.QiniuDomain), cfg.QiniuDomain)
|
||||
}
|
||||
|
||||
func storagePublicBaseURL(domain string) string {
|
||||
@@ -147,13 +147,18 @@ func storagePublicBaseURL(domain string) string {
|
||||
return "https://" + base
|
||||
}
|
||||
|
||||
func rewriteLegacyQiniuURLs(html, targetBase string) string {
|
||||
func rewriteLegacyQiniuURLs(html, targetBase, qiniuDomain string) string {
|
||||
if targetBase == "" {
|
||||
return html
|
||||
}
|
||||
for _, domain := range legacyQiniuDomains {
|
||||
domains := append(legacyQiniuDomains, qiniuDomain)
|
||||
for _, domain := range domains {
|
||||
d := strings.TrimSpace(domain)
|
||||
if d == "" {
|
||||
continue
|
||||
}
|
||||
for _, scheme := range []string{"http://", "https://"} {
|
||||
html = strings.ReplaceAll(html, scheme+domain+"/", targetBase+"/")
|
||||
html = strings.ReplaceAll(html, scheme+d+"/", targetBase+"/")
|
||||
}
|
||||
}
|
||||
return html
|
||||
|
||||
Reference in New Issue
Block a user