File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -997,8 +997,8 @@ export default class RequestHandler {
997997 errorCode : ErrorCode . InvalidSearch ,
998998 } ) ;
999999 }
1000- const contextLength : number =
1001- parseInt ( req . query . contextLength as string , 10 ) ?? 100 ;
1000+ const contextLengthRaw = parseInt ( req . query . contextLength as string , 10 ) ;
1001+ const contextLength = Number . isNaN ( contextLengthRaw ) ? 100 : contextLengthRaw ;
10021002 let search : ReturnType < typeof prepareSimpleSearch > ;
10031003 try {
10041004 search = prepareSimpleSearch ( query ) ;
@@ -1019,9 +1019,9 @@ export default class RequestHandler {
10191019
10201020 // We added the headline to the search text with 2 line breaks.
10211021 // That causes the start and end position numbers to be wrong with an offset
1022- // of the char length of the headline + 2 line breaks.
1022+ // of the char length of the headline line breaks.
10231023 // This is fixed by substracting the positionOffset from the start and end position.
1024- const positionOffset = filenamePrefix . length - 1 ;
1024+ const positionOffset = filenamePrefix . length ;
10251025
10261026 if ( result ) {
10271027 const contextMatches : SearchContext [ ] = [ ] ;
You can’t perform that action at this time.
0 commit comments