mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	raw download
This commit is contained in:
		@@ -6,6 +6,7 @@ package base
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"path"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"strings"
 | 
			
		||||
@@ -42,6 +43,14 @@ func IsMarkdownFile(name string) bool {
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func IsTextFile(data []byte) (string, bool) {
 | 
			
		||||
	contentType := http.DetectContentType(data)
 | 
			
		||||
	if strings.Index(contentType, "text/") != -1 {
 | 
			
		||||
		return contentType, true
 | 
			
		||||
	}
 | 
			
		||||
	return contentType, false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func IsReadmeFile(name string) bool {
 | 
			
		||||
	name = strings.ToLower(name)
 | 
			
		||||
	if len(name) < 6 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user