mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	fix: trim the whitespaces for the search keyword (#893)
This commit is contained in:
		@@ -5,7 +5,7 @@
 | 
			
		||||
package repo
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"path"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	api "code.gitea.io/sdk/gitea"
 | 
			
		||||
 | 
			
		||||
@@ -21,7 +21,7 @@ import (
 | 
			
		||||
// see https://github.com/gogits/go-gogs-client/wiki/Repositories#search-repositories
 | 
			
		||||
func Search(ctx *context.APIContext) {
 | 
			
		||||
	opts := &models.SearchRepoOptions{
 | 
			
		||||
		Keyword:  path.Base(ctx.Query("q")),
 | 
			
		||||
		Keyword:  strings.Trim(ctx.Query("q"), " "),
 | 
			
		||||
		OwnerID:  ctx.QueryInt64("uid"),
 | 
			
		||||
		PageSize: convert.ToCorrectPageSize(ctx.QueryInt("limit")),
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user