mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	* Updated vendor code for code.gitea.io/git * Display symlinks correctly for files and directories * Added symlink tests * Applied silverwinds stylesheet patch Signed-off-by: Tris Forster <tris.git@shoddynet.org>
This commit is contained in:
		@@ -23,6 +23,7 @@ import (
 | 
			
		||||
	"unicode"
 | 
			
		||||
	"unicode/utf8"
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/git"
 | 
			
		||||
	"code.gitea.io/gitea/modules/log"
 | 
			
		||||
	"code.gitea.io/gitea/modules/setting"
 | 
			
		||||
	"code.gitea.io/gitea/modules/util"
 | 
			
		||||
@@ -559,3 +560,25 @@ func IsPDFFile(data []byte) bool {
 | 
			
		||||
func IsVideoFile(data []byte) bool {
 | 
			
		||||
	return strings.Index(http.DetectContentType(data), "video/") != -1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EntryIcon returns the octicon class for displaying files/directories
 | 
			
		||||
func EntryIcon(entry *git.TreeEntry) string {
 | 
			
		||||
	switch {
 | 
			
		||||
	case entry.IsLink():
 | 
			
		||||
		te, err := entry.FollowLink()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Debug(err.Error())
 | 
			
		||||
			return "file-symlink-file"
 | 
			
		||||
		}
 | 
			
		||||
		if te.IsDir() {
 | 
			
		||||
			return "file-symlink-directory"
 | 
			
		||||
		}
 | 
			
		||||
		return "file-symlink-file"
 | 
			
		||||
	case entry.IsDir():
 | 
			
		||||
		return "file-directory"
 | 
			
		||||
	case entry.IsSubModule():
 | 
			
		||||
		return "file-submodule"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return "file-text"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user