File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 1+ using System . Linq ;
12using System . Threading . Tasks ;
23using Microsoft . AspNetCore . Mvc ;
34using Microsoft . AspNetCore . Mvc . Filters ;
@@ -58,6 +59,11 @@ public IPublishedContent FindContent(ActionExecutingContext actionExecutingConte
5859 [ HttpGet ]
5960 public async Task < IActionResult > MemberProfile ( string username )
6061 {
62+ if ( string . IsNullOrWhiteSpace ( username ) || username . Any ( c => ! char . IsLetterOrDigit ( c ) ) )
63+ {
64+ return NotFound ( ) ;
65+ }
66+
6167 var memberUser = await _memberManager . FindByNameAsync ( username ) ;
6268 if ( memberUser == null )
6369 {
Original file line number Diff line number Diff line change 6666 {
6767 u . EndpointRouteBuilder . MapControllerRoute (
6868 "ProfileCustomRoute" ,
69- "member/{username}" ,
69+ "member/{username:regex(^[a-zA-Z0-9]+$) }" ,
7070 new { Controller = "Member" , Action = "MemberProfile" } ) ;
7171 u . UseBackOfficeEndpoints ( ) ;
7272 u . UseWebsiteEndpoints ( ) ;
You can’t perform that action at this time.
0 commit comments