@@ -474,9 +474,6 @@ private bool TryGetMapping(StaticWebAssetGlobMatcher.MatchContext context, TaskL
474474
475475#if NET9_0_OR_GREATER
476476 private static ReadOnlySpan < char > ResolvePathWithoutCompressedExtension ( ReadOnlySpan < char > fileName , out bool hasCompressedExtension )
477- #else
478- private static string ResolvePathWithoutCompressedExtension ( string fileName , out bool hasCompressedExtension )
479- #endif
480477 {
481478 var extension = Path . GetExtension ( fileName ) ;
482479 hasCompressedExtension = extension . Equals ( ".gz" , StringComparison . OrdinalIgnoreCase ) || extension . Equals ( ".br" , StringComparison . OrdinalIgnoreCase ) ;
@@ -485,14 +482,27 @@ private static string ResolvePathWithoutCompressedExtension(string fileName, out
485482 var fileNameNoExtension = Path . GetFileNameWithoutExtension ( fileName ) ;
486483 if ( ! Path . GetExtension ( fileNameNoExtension ) . Equals ( "" , StringComparison . Ordinal ) )
487484 {
488- #if NET9_0_OR_GREATER
489485 return fileName [ ..fileNameNoExtension . Length ] ;
486+ }
487+ }
488+
489+ return fileName ;
490+ }
490491#else
492+ private static string ResolvePathWithoutCompressedExtension ( string fileName , out bool hasCompressedExtension )
493+ {
494+ var extension = Path . GetExtension ( fileName ) ;
495+ hasCompressedExtension = extension != null && extension . Equals ( ".gz" , StringComparison . OrdinalIgnoreCase ) || extension . Equals ( ".br" , StringComparison . OrdinalIgnoreCase ) ;
496+ if ( hasCompressedExtension )
497+ {
498+ var fileNameNoExtension = Path . GetFileNameWithoutExtension ( fileName ) ;
499+ if ( ! string . Equals ( Path . GetExtension ( fileNameNoExtension ) , "" , StringComparison . Ordinal ) )
500+ {
491501 return fileName . Substring ( 0 , fileNameNoExtension . Length ) ;
492- #endif
493502 }
494503 }
495504
496505 return fileName ;
497506 }
507+ #endif
498508}
0 commit comments