From e760c7b4707ce35d7fa9b5ade7d0f230af7e5362 Mon Sep 17 00:00:00 2001 From: Hiromu Nakamura Date: Sat, 27 Jul 2024 23:52:21 +0900 Subject: [PATCH] Enabling numContextLines in non-json format --- web/server.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/web/server.go b/web/server.go index 75b631fd2..0c717e89a 100644 --- a/web/server.go +++ b/web/server.go @@ -280,12 +280,10 @@ func (s *Server) serveSearchErr(r *http.Request) (*ApiSearchResult, error) { } numCtxLines := 0 - if qvals.Get("format") == "json" { - if ctxLinesStr := qvals.Get("ctx"); ctxLinesStr != "" { - numCtxLines, err = strconv.Atoi(ctxLinesStr) - if err != nil || numCtxLines < 0 || numCtxLines > 10 { - return nil, fmt.Errorf("Number of context lines must be between 0 and 10") - } + if ctxLinesStr := qvals.Get("ctx"); ctxLinesStr != "" { + numCtxLines, err = strconv.Atoi(ctxLinesStr) + if err != nil || numCtxLines < 0 || numCtxLines > 10 { + return nil, fmt.Errorf("Number of context lines must be between 0 and 10") } } sOpts.NumContextLines = numCtxLines