Skip to content

Commit

Permalink
feat: Disallow first-level tag names to be "x" or "X"
Browse files Browse the repository at this point in the history
  • Loading branch information
MH321Productions committed Feb 25, 2025
1 parent 6daf5b7 commit 2f59caf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Modules/Tags/src/Tags.Application/ApplicationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public class ContainsValidTagsAttribute : ValidationAttribute
if (notImplementedLanguages.Count != 0)
return new ValidationResult($"A display name for the language(s) \"{Enumerate(notImplementedLanguages)}\" is required.", [GetPathOfProperty(nameParts)]);

var tagName = nameParts.Last();
if (nameParts.Count() == 2 && tagName.Equals("x", StringComparison.OrdinalIgnoreCase))
return new ValidationResult("A first-level tag may not be equal to \"x\" or \"X\".", [GetPathOfProperty(nameParts)]);

foreach (var (childName, child) in tag.Children)
{
var result = ValidateTag(nameParts.Append(childName), child);
Expand Down

0 comments on commit 2f59caf

Please sign in to comment.