@@ -20,6 +20,11 @@ public class AzureBlobFileSystemImageProvider : IImageProvider
20
20
private string _rootPath ;
21
21
private readonly FormatUtilities _formatUtilities ;
22
22
23
+ /// <summary>
24
+ /// A match function used by the resolver to identify itself as the correct resolver to use.
25
+ /// </summary>
26
+ private Func < HttpContext , bool > ? _match ;
27
+
23
28
/// <summary>
24
29
/// Initializes a new instance of the <see cref="AzureBlobFileSystemImageProvider" /> class.
25
30
/// </summary>
@@ -68,8 +73,7 @@ public bool IsValidRequest(HttpContext context)
68
73
{
69
74
if ( context == null ) throw new ArgumentNullException ( nameof ( context ) ) ;
70
75
71
- return context . Request . Path . StartsWithSegments ( _rootPath , StringComparison . InvariantCultureIgnoreCase )
72
- && _formatUtilities . GetExtensionFromUri ( context . Request . GetDisplayUrl ( ) ) != null ;
76
+ return _formatUtilities . GetExtensionFromUri ( context . Request . GetDisplayUrl ( ) ) != null ;
73
77
}
74
78
75
79
/// <inheritdoc />
@@ -95,8 +99,19 @@ public bool IsValidRequest(HttpContext context)
95
99
/// <inheritdoc />
96
100
public ProcessingBehavior ProcessingBehavior => ProcessingBehavior . CommandOnly ;
97
101
98
- /// <inheritdoc />
99
- public Func < HttpContext , bool > Match { get ; set ; } = _ => true ;
102
+ /// <inheritdoc/>
103
+ public Func < HttpContext , bool > Match
104
+ {
105
+ get => this . _match ?? IsMatch ;
106
+ set => this . _match = value ;
107
+ }
108
+
109
+ private bool IsMatch ( HttpContext context )
110
+ {
111
+ if ( context == null ) throw new ArgumentNullException ( nameof ( context ) ) ;
112
+
113
+ return context . Request . Path . StartsWithSegments ( _rootPath , StringComparison . InvariantCultureIgnoreCase ) ;
114
+ }
100
115
101
116
private void OptionsOnChange ( AzureBlobFileSystemOptions options , string name , IHostingEnvironment hostingEnvironment )
102
117
{
0 commit comments