File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
src/management/Akka.Management/Routes Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -81,8 +81,27 @@ public override async Task<bool> HandleAsync(IAkkaHttpContext context)
8181 await context . HttpContext . Response . WriteAllJsonAsync ( response ) ;
8282 return true ;
8383 }
84+
85+ // Check that ClusterClientReceptionist name is valid
86+ var name = config . GetString ( "name" ) ;
87+ if ( string . IsNullOrWhiteSpace ( name ) || ! ActorPath . IsValidPathElement ( name ) )
88+ {
89+ context . HttpContext . Response . StatusCode = HttpStatusCode . InternalServerError ;
90+ var response = JsonConvert . SerializeObject ( new
91+ {
92+ error = new
93+ {
94+ reason = "not available" ,
95+ message = "ClusterClientReceptionist name is invalid"
96+ } ,
97+ code = ( int ) HttpStatusCode . InternalServerError ,
98+ message = "ClusterClientReceptionist name is invalid"
99+ } ) ;
100+ await context . HttpContext . Response . WriteAllJsonAsync ( response ) ;
101+ return true ;
102+ }
84103
85- var actorPath = new RootActorPath ( actorProvider . DefaultAddress ) / "system" / config . GetString ( " name" ) ;
104+ var actorPath = new RootActorPath ( actorProvider . DefaultAddress ) / "system" / name ;
86105 var json = JsonConvert . SerializeObject ( new { ReceptionistPath = actorPath . ToString ( ) } ) ;
87106 await context . HttpContext . Response . WriteAllJsonAsync ( json ) ;
88107
You can’t perform that action at this time.
0 commit comments