-
-
Notifications
You must be signed in to change notification settings - Fork 218
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: add detection for more model errors #485
base: master
Are you sure you want to change the base?
Conversation
@nodece @Shivansh-yadav13 please review |
const key = line.substring(0, equalIndex); | ||
const value = line.substring(equalIndex + 1); | ||
this.addConfig(section, key.trim(), value.trim()); | ||
const key = line.substring(0, equalIndex).trim(); |
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.
Extract all grammar checking code into a "validator"
|
||
// Verify operator in matcher | ||
public static validateMatcherOperators(value: string): void { | ||
const invalidOperators = /(?<![&|])&(?!&)|(?![&|])\|(?!\|)|&{3,}|\|{3,}/g; |
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.
This function is using same RegExp as validateMatcher
, without any reference but just as a copy - that potentially could cause a mistake in future (when RegExp will be changed in one place, but not both).
Also this kind of RegExp (especialy LookBehind) has limited support on a not so old browsers like iOS 16 (<16.4), that could lead developers to patching casbin to use with such browsers.
fix:casbin/casbin-editor#162