@@ -8,7 +8,7 @@ export default class MessageService {
8
8
constructor (
9
9
@InjectRepository ( MessageEntity )
10
10
private messageRepository : Repository < MessageEntity > ,
11
- ) { }
11
+ ) { }
12
12
13
13
public static modelToEntity ( model : MessageModel , connectionId : string | undefined ) : MessageEntity {
14
14
return {
@@ -64,7 +64,7 @@ export default class MessageService {
64
64
if ( topic . startsWith ( '$share/' ) ) topic = topic . split ( '/' ) . slice ( 2 ) . join ( '/' )
65
65
if ( topic . includes ( '#' ) ) topic = topic . replace ( '/#' , '%' )
66
66
if ( topic . includes ( '+' ) ) topic = topic . replace ( '+' , '%' )
67
- query . andWhere ( 'msg.topic LIKE :topic' , { topic } )
67
+ query . andWhere ( 'msg.topic LIKE :topic ESCAPE "\\" ' , { topic } )
68
68
}
69
69
70
70
if ( options . searchParams ) {
@@ -121,7 +121,7 @@ export default class MessageService {
121
121
if ( topic . startsWith ( '$share/' ) ) topic = topic . split ( '/' ) . slice ( 2 ) . join ( '/' )
122
122
if ( topic . includes ( '#' ) ) topic = topic . replace ( '/#' , '%' )
123
123
if ( topic . includes ( '+' ) ) topic = topic . replace ( '+' , '%' )
124
- query . andWhere ( 'msg.topic LIKE :topic' , { topic } )
124
+ query . andWhere ( 'msg.topic LIKE :topic ESCAPE "\\" ' , { topic } )
125
125
}
126
126
127
127
if ( options . searchParams ) {
0 commit comments