Skip to content

Commit 62a05e2

Browse files
mynameisbogdanbakerboy448
authored andcommitted
Fixed: Validation for tags label
1 parent f04bff8 commit 62a05e2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/Radarr.Api.V3/Tags/TagController.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.Text.RegularExpressions;
23
using FluentValidation;
34
using Microsoft.AspNetCore.Mvc;
45
using NzbDrone.Core.AutoTagging;
@@ -25,7 +26,10 @@ public TagController(IBroadcastSignalRMessage signalRBroadcaster,
2526
{
2627
_tagService = tagService;
2728

28-
SharedValidator.RuleFor(c => c.Label).NotEmpty();
29+
SharedValidator.RuleFor(c => c.Label).Cascade(CascadeMode.Stop)
30+
.NotEmpty()
31+
.Matches("^[a-z0-9-]+$", RegexOptions.IgnoreCase)
32+
.WithMessage("Allowed characters a-z, 0-9 and -");
2933
}
3034

3135
protected override TagResource GetResourceById(int id)

0 commit comments

Comments
 (0)