mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Use url.Parse to parse hostname (#12335)
This commit is contained in:
		| @@ -626,11 +626,8 @@ func NewContext() { | ||||
| 	StaticURLPrefix = strings.TrimSuffix(sec.Key("STATIC_URL_PREFIX").MustString(AppSubURL), "/") | ||||
| 	AppSubURLDepth = strings.Count(AppSubURL, "/") | ||||
| 	// Check if Domain differs from AppURL domain than update it to AppURL's domain | ||||
| 	urlHostname, _, err := net.SplitHostPort(appURL.Host) | ||||
| 	if err != nil { | ||||
| 		log.Fatal("Invalid host in ROOT_URL '%s': %s", appURL.Host, err) | ||||
| 	} | ||||
| 	if urlHostname != Domain && net.ParseIP(urlHostname) == nil { | ||||
| 	urlHostname := appURL.Hostname() | ||||
| 	if urlHostname != Domain && net.ParseIP(urlHostname) == nil && urlHostname != "" { | ||||
| 		Domain = urlHostname | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user