mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	modules/base: fix README filename checker, fix #877
This commit is contained in:
		
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							@@ -17,7 +17,7 @@ import (
 | 
				
			|||||||
	"github.com/gogits/gogs/modules/setting"
 | 
						"github.com/gogits/gogs/modules/setting"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const APP_VER = "0.5.12.0201 Beta"
 | 
					const APP_VER = "0.5.12.0202 Beta"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
						runtime.GOMAXPROCS(runtime.NumCPU())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,12 +63,18 @@ func IsImageFile(data []byte) (string, bool) {
 | 
				
			|||||||
	return contentType, false
 | 
						return contentType, false
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// IsReadmeFile returns true if given file name suppose to be a README file.
 | 
				
			||||||
func IsReadmeFile(name string) bool {
 | 
					func IsReadmeFile(name string) bool {
 | 
				
			||||||
	name = strings.ToLower(name)
 | 
						name = strings.ToLower(name)
 | 
				
			||||||
	if len(name) < 6 {
 | 
						if len(name) < 6 {
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
 | 
						} else if len(name) == 6 {
 | 
				
			||||||
 | 
							if name == "readme" {
 | 
				
			||||||
 | 
								return true
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if name[:6] == "readme" {
 | 
						if name[:7] == "readme." {
 | 
				
			||||||
		return true
 | 
							return true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return false
 | 
						return false
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1 +1 @@
 | 
				
			|||||||
0.5.12.0201 Beta
 | 
					0.5.12.0202 Beta
 | 
				
			||||||
		Reference in New Issue
	
	Block a user