-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat: Panel aliases support common special characters #7654
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ function checkPanelName(rule: any, value: any, callback: any) { | |
if (value === '') { | ||
return callback(new Error(i18n.global.t('setting.titleHelper'))); | ||
} | ||
const reg = /^[a-zA-Z0-9\u4e00-\u9fa5]{1}[a-zA-Z0-9_ .\u4e00-\u9fa5-]{2,29}$/; | ||
const reg = /^[a-zA-Z0-9\u4e00-\u9fa5 .,:!@#%&^*_+[\]{}~\-=?,。!|?:;「」『』【】()《》·]{3,30}$/; | ||
if (!reg.test(value)) { | ||
return callback(new Error(i18n.global.t('setting.titleHelper'))); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The provided code difference introduces an updated regex pattern that allows alphanumeric characters including some special symbols such as Optimization suggestion: Potential issue: "change": {
"regex": "^\\w{3,30}$
} This would restrict the rule to only accept words consisting of alphanumeric characters and underscore, which aligns closely with common naming conventions used across many systems and applications while maintaining minimal risk and simplicity of integration into existing workflows. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regular expression in your function has been modified to allow more characters, such as punctuation marks and symbols. While this might be necessary based on specific requirements, it may also result in validation errors that were previously acceptable due to the stricter pattern defined initially. It's recommended to thoroughly test with various inputs (including edge cases) to ensure correct functionality.
Additionally, consider adding a comment explanation of why the change was made, especially since
reg
is reused elsewhere in your codebase. This could help maintain clarity for other developers who work on this part of the code in the future.