File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { SuggestedUserDto } from './dto/suggested-user.dto';
1616import { TweetResponseDTO } from 'src/tweets/dto' ;
1717import { RedisService } from 'src/redis/redis.service' ;
1818import { TweetType } from 'src/shared/enums/tweet-types.enum' ;
19+ import { STRING_MAX_LENGTH } from 'src/constants/variables' ;
1920
2021@Injectable ( )
2122export class SearchService {
@@ -1140,7 +1141,8 @@ export class SearchService {
11401141 . replace ( / [ , ; : ] + $ / , '' )
11411142 . trim ( ) ;
11421143
1143- if ( completion . length < query . length + 3 ) return ;
1144+ if ( completion . length < query . length + 3 || completion . length > STRING_MAX_LENGTH )
1145+ return ;
11441146 if ( ! completion . toLowerCase ( ) . startsWith ( query_lower ) ) return ;
11451147 const middle_content = completion . substring ( 0 , completion . length - 1 ) ;
11461148 if ( / [ . ! ? ] / . test ( middle_content ) ) return ;
You can’t perform that action at this time.
0 commit comments