Bounds check color parameter validation

This commit is contained in:
Ske 2019-07-10 10:02:46 +02:00
parent 9b488d1ab5
commit 372a618cbe

View File

@ -116,7 +116,7 @@ namespace PluralKit.Bot.Commands
if (color != null) if (color != null)
{ {
if (color.StartsWith("#")) color = color.Substring(1); if (color.StartsWith("#")) color = color.Substring(1);
if (!Regex.IsMatch(color, "[0-9a-f]{6}")) throw Errors.InvalidColorError(color); if (!Regex.IsMatch(color, "^[0-9a-f]{6}$")) throw Errors.InvalidColorError(color);
} }
ContextEntity.Color = color; ContextEntity.Color = color;