diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index f8c50af53c..01fd1e2725 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -203,7 +203,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption opt keyword = "" } - isFuzzy := ctx.FormBool("fuzzy") + isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true) var mileIDs []int64 if milestoneID > 0 || milestoneID == db.NoConditionID { // -1 to get those issues which have no any milestone assigned diff --git a/routers/web/user/home.go b/routers/web/user/home.go index 55d579eb2d..1ac2ec8e5f 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -448,7 +448,7 @@ func buildIssueOverview(ctx *context.Context, unitType unit.Type) { User: ctx.Doer, } - isFuzzy := ctx.FormBool("fuzzy") + isFuzzy := ctx.FormOptionalBool("fuzzy").ValueOrDefault(true) // Search all repositories which // diff --git a/tests/integration/issue_test.go b/tests/integration/issue_test.go index 4d9d99fb5e..26ae2d45a3 100644 --- a/tests/integration/issue_test.go +++ b/tests/integration/issue_test.go @@ -146,17 +146,19 @@ func TestViewIssuesKeyword(t *testing.T) { assert.EqualValues(t, 0, issuesSelection.Length()) // should match as 'first' when fuzzy seaeching is enabled - req = NewRequestf(t, "GET", "%s/issues?q=%st&fuzzy=true", repo.Link(), keyword) - resp = MakeRequest(t, req, http.StatusOK) - htmlDoc = NewHTMLParser(t, resp.Body) - issuesSelection = getIssuesSelection(t, htmlDoc) - assert.EqualValues(t, 1, issuesSelection.Length()) - issuesSelection.Each(func(_ int, selection *goquery.Selection) { - issue := getIssue(t, repo.ID, selection) - assert.False(t, issue.IsClosed) - assert.False(t, issue.IsPull) - assertMatch(t, issue, keyword) - }) + for _, fmt := range []string{"%s/issues?q=%st&fuzzy=true", "%s/issues?q=%st"} { + req = NewRequestf(t, "GET", fmt, repo.Link(), keyword) + resp = MakeRequest(t, req, http.StatusOK) + htmlDoc = NewHTMLParser(t, resp.Body) + issuesSelection = getIssuesSelection(t, htmlDoc) + assert.EqualValues(t, 1, issuesSelection.Length()) + issuesSelection.Each(func(_ int, selection *goquery.Selection) { + issue := getIssue(t, repo.ID, selection) + assert.False(t, issue.IsClosed) + assert.False(t, issue.IsPull) + assertMatch(t, issue, keyword) + }) + } } func TestViewIssuesSearchOptions(t *testing.T) {