@@ -27,6 +27,11 @@ type ErrorAttributes = {
2727 [ key : string ] : unknown ;
2828} ;
2929
30+ function escapeClickHouseString ( val : string ) : string {
31+ return val . replace ( / \/ / g, "\\/" ) ;
32+ }
33+
34+
3035export type LogsListOptions = {
3136 userId ?: string ;
3237 projectId : string ;
@@ -294,11 +299,11 @@ export class LogsListPresenter extends BasePresenter {
294299
295300 // Case-insensitive search in message, attributes, and status fields
296301 if ( search && search . trim ( ) !== "" ) {
297- const searchTerm = search . trim ( ) ;
302+ const searchTerm = escapeClickHouseString ( search . trim ( ) ) . toLowerCase ( ) ;
298303 queryBuilder . where (
299304 "(lower(message) like {searchPattern: String} OR lower(attributes_text) like {searchPattern: String})" ,
300305 {
301- searchPattern : `%${ searchTerm . toLowerCase ( ) } %`
306+ searchPattern : `%${ searchTerm } %`
302307 }
303308 ) ;
304309 }
@@ -361,7 +366,7 @@ export class LogsListPresenter extends BasePresenter {
361366 const decodedCursor = cursor ? decodeCursor ( cursor ) : null ;
362367 if ( decodedCursor ) {
363368 queryBuilder . where (
364- "(environment_id, toUnixTimestamp(start_time), trace_id) > ({cursorEnvId: String}, {cursorUnixTimestamp: Int64}, {cursorTraceId: String})" ,
369+ "(environment_id, toUnixTimestamp(start_time), trace_id) < ({cursorEnvId: String}, {cursorUnixTimestamp: Int64}, {cursorTraceId: String})" ,
365370 {
366371 cursorEnvId : decodedCursor . environmentId ,
367372 cursorUnixTimestamp : decodedCursor . unixTimestamp ,
0 commit comments