@@ -329,6 +329,15 @@ public static bool TryParse(string path, out ActorPath actorPath)
329
329
330
330
if ( ! TryParseAddress ( path , out var address , out var absoluteUri ) ) return false ;
331
331
var spanified = absoluteUri ;
332
+
333
+ // check for Uri fragment here
334
+ var fragment = ReadOnlySpan < char > . Empty ;
335
+ var fragLoc = spanified . IndexOf ( '#' ) ;
336
+ if ( fragLoc > - 1 )
337
+ {
338
+ fragment = spanified . Slice ( fragLoc + 1 ) ;
339
+ spanified = spanified . Slice ( 0 , fragLoc ) ;
340
+ }
332
341
var nextSlash = 0 ;
333
342
334
343
actorPath = new RootActorPath ( address ) ;
@@ -348,12 +357,11 @@ public static bool TryParse(string path, out ActorPath actorPath)
348
357
spanified = spanified . Slice ( nextSlash + 1 ) ;
349
358
} while ( nextSlash >= 0 ) ;
350
359
351
- //var fragmentLocation =
352
- //if (.StartsWith("#"))
353
- //{
354
- // var uid = SpanHacks.Parse(uri.Fragment.AsSpan(1));
355
- // actorPath = actorPath.WithUid(uid);
356
- //}
360
+ if ( ! fragment . IsEmpty )
361
+ {
362
+ var uid = SpanHacks . Parse ( fragment ) ;
363
+ actorPath = actorPath . WithUid ( uid ) ;
364
+ }
357
365
return true ;
358
366
}
359
367
@@ -392,7 +400,7 @@ private static bool TryParseAddress(string path, out Address address, out ReadOn
392
400
return false ;
393
401
394
402
spanified = spanified . Slice ( firstColonPos + 1 ) ;
395
- if ( ! ( spanified [ 0 ] == '/' && spanified [ 1 ] == '/' ) )
403
+ if ( spanified . Length < 2 || ! ( spanified [ 0 ] == '/' && spanified [ 1 ] == '/' ) )
396
404
return false ;
397
405
398
406
spanified = spanified . Slice ( 2 ) ; // move past the double //
0 commit comments