From d08ab91c1936613e95daad3c56e24125f7899166 Mon Sep 17 00:00:00 2001 From: po3rin Date: Sun, 28 Jul 2024 00:18:25 +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