Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add escape char to _ to avoid sql pattern matching #556

Merged
merged 5 commits into from
Mar 6, 2024

Conversation

Tooseriuz
Copy link
Member

✅ DoD

(use na when API docs (Release notes, etc) do not need to be updated)

📝 Summary

  • Add escape to _ in stream name duplicate checking

@Tooseriuz Tooseriuz self-assigned this Mar 5, 2024
@@ -116,7 +116,7 @@ async function query (filters, options = {}) {
if (filters.names) {
where.name = {
[Sequelize.Op.iLike]: {
[Sequelize.Op.any]: filters.names.map(n => `${n.replace(/^\*/, '%').replace(/\*$/, '%')}`)
[Sequelize.Op.any]: filters.names.map(n => `${n.replace(/^\*/, '%').replace(/\*$/, '%').replaceAll('_', '\\_')}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check if sequelize has some built-in escape functions? I guess _ may be not the only character we may want to escape

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tooseriuz Tooseriuz merged commit 5501e26 into develop Mar 6, 2024
3 checks passed
@Tooseriuz Tooseriuz deleted the bug/cannot-change-site-name-underscore-hyphen branch March 6, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot create/update site name from _ to -
2 participants