mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 08:21:11 +00:00 
			
		
		
		
	Merge pull request #1836 from likeit92/develop
workaround for reverse proxy, ssh, submodule
This commit is contained in:
		
				commit
				
					
						379629d28a
					
				
			
		
					 1 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -6,6 +6,7 @@ package git
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"github.com/gogits/gogs/modules/setting"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type SubModule struct {
 | 
			
		||||
| 
						 | 
				
			
			@ -51,8 +52,14 @@ func (sf *SubModuleFile) RefUrl() string {
 | 
			
		|||
	i := strings.Index(url, "@")
 | 
			
		||||
	j := strings.LastIndex(url, ":")
 | 
			
		||||
	if i > -1 && j > -1 {
 | 
			
		||||
		// fix problem with reverse proxy works only with local server
 | 
			
		||||
		if strings.Contains(setting.AppUrl,url[i+1:j]) {
 | 
			
		||||
			return setting.AppUrl + url[j+1:]
 | 
			
		||||
		} else {
 | 
			
		||||
			return "http://" + url[i+1:j] + "/" + url[j+1:]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return url
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue