You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "jokerzsd (via GitHub)" <gi...@apache.org> on 2026/09/16 09:17:51 UTC

[PR] fix(studio): add explicit ESCAPE clause to LIKE searches [rocketmq-dashboard]

jokerzsd opened a new pull request, #4363:
URL: https://github.com/apache/rocketmq-dashboard/pull/4363

   Resubmit of #4236 per @lizhimins's review, adding the explicit `ESCAPE` clause so the escaping is dialect-independent.
   
   ## Summary
   
   User-supplied search strings in topic/group metadata search and data source search were passed into MyBatis-Plus `like()`, so `%`, `_` and `\` were treated as SQL wildcards/escape characters. The prior fix escaped the value but relied on MySQL's implicit backslash escape character, which is wrong on H2 (no default LIKE escape character).
   
   ## Fix
   
   - Add a shared `SqlLikeUtils` helper (`escape` + `contains` + the `ESCAPE` clause constant).
   - Replace the five `.like()` predicates with `.apply(..., "name LIKE {0} ESCAPE '\'", SqlLikeUtils.contains(search))` (four in `RocketMQMetadataProvider`, one in `MybatisPlusSettingsRepository.findDataSources`), so the backslash is explicitly the escape character on every dialect.
   
   ## Tests
   
   - `RocketMQMetadataProviderTest.searchEscapesLikeWildcardsAndAddsExplicitEscapeClause`: asserts the wrapper contains `LIKE`/`ESCAPE` and the bound parameter is `%prod\_user%` for both topic and group search.
   - `MybatisPlusSettingsRepositoryTest.findDataSourcesEscapesSearchWildcardsAndAddsEscapeClause`: same assertion for the data source search.
   
   ## Verification
   
   `mvn test -Dtest=RocketMQMetadataProviderTest` → 42 passed.
   `mvn test -Dtest=MybatisPlusSettingsRepositoryTest` → 11 passed.
   
   Closes #4236.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(studio): add explicit ESCAPE clause to LIKE searches [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #4363: fix(studio): add explicit ESCAPE clause to LIKE searches
URL: https://github.com/apache/rocketmq-dashboard/pull/4363


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org