mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	fix: trim the whitespaces for the search keyword (#893)
This commit is contained in:
		@@ -7,6 +7,7 @@ package repo
 | 
			
		||||
import (
 | 
			
		||||
	"container/list"
 | 
			
		||||
	"path"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/git"
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
@@ -106,7 +107,7 @@ func Graph(ctx *context.Context) {
 | 
			
		||||
func SearchCommits(ctx *context.Context) {
 | 
			
		||||
	ctx.Data["PageIsCommits"] = true
 | 
			
		||||
 | 
			
		||||
	keyword := ctx.Query("q")
 | 
			
		||||
	keyword := strings.Trim(ctx.Query("q"), " ")
 | 
			
		||||
	if len(keyword) == 0 {
 | 
			
		||||
		ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchName)
 | 
			
		||||
		return
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user