@@ -124,6 +124,33 @@ private bool ShouldMatch(string currentUriAbsolute)
124124 return true ;
125125 }
126126
127+ if ( Match == NavLinkMatch . All
128+ && IsStrictlyPrefixIgnoringQueryAndFragment ( currentUriAbsolute ) )
129+ {
130+ return true ;
131+ }
132+
133+ return false ;
134+ }
135+
136+ private bool IsStrictlyPrefixIgnoringQueryAndFragment ( string currentUriAbsolute )
137+ {
138+ Debug . Assert ( _hrefAbsolute != null ) ;
139+
140+ return IsStrictlyPrefixedIgnoringSuffixAfterSymbol ( currentUriAbsolute , '?' )
141+ || IsStrictlyPrefixedIgnoringSuffixAfterSymbol ( currentUriAbsolute , '#' ) ;
142+ }
143+
144+ private bool IsStrictlyPrefixedIgnoringSuffixAfterSymbol ( string currentUriAbsolute , char symbol )
145+ {
146+ Debug . Assert ( _hrefAbsolute != null ) ;
147+
148+ var fragmentIndex = currentUriAbsolute . IndexOf ( symbol ) ;
149+ if ( fragmentIndex >= 0 )
150+ {
151+ var prefix = currentUriAbsolute . Substring ( 0 , fragmentIndex ) ;
152+ return IsStrictlyPrefixWithSeparator ( currentUriAbsolute , prefix ) ;
153+ }
127154 return false ;
128155 }
129156
@@ -199,7 +226,7 @@ private static bool IsStrictlyPrefixWithSeparator(string value, string prefix)
199226
200227 private static bool IsUnreservedCharacter ( char c )
201228 {
202- // Checks whether it is an unreserved character according to
229+ // Checks whether it is an unreserved character according to
203230 // https://datatracker.ietf.org/doc/html/rfc3986#section-2.3
204231 // Those are characters that are allowed in a URI but do not have a reserved
205232 // purpose (e.g. they do not separate the components of the URI)
0 commit comments