You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
isRgbColor: Invalid rgb percentage strings are matched as valid #2113
Describe the bug
Invalid rgba percentage strings are getting passed as valid
Examples rgb(5%,5%,5%) helloWorld!
I would expect isRgbColor to return false here, due to the additional string content, after the valid rgb color value, however it currently will return true
The bug is caused by a missing $ at the end of the RegExp:
const rgbColorPercent = /^rgb((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%))/;
const rgbaColorPercent = /^rgba((([0-9]%|[1-9][0-9]%|100%),){3}(0?.\d|1(.0)?|0(.0)?))/;
PR that fixes this will be created in a few moments
Activity
fix(isRgbColor): add missing RegExp anchor (end-of-string)
test(isRgbColor): add additional invalid tests
fix(isRgbColor): add missing RegExp anchor (end-of-string)
test(isRgbColor): add additional invalid tests
fix(isRgbColor): fix validation of rgb(a) ColorPercentage strings (#2114