11// Copyright (c) Six Labors.
22// Licensed under the Six Labors Split License.
3- #nullable disable
43
54using System . Globalization ;
65using System . Text ;
109using Microsoft . AspNetCore . Mvc . TagHelpers ;
1110using Microsoft . AspNetCore . Razor . TagHelpers ;
1211using Microsoft . Extensions . Options ;
13- using SixLabors . ImageSharp . Processing ;
1412using SixLabors . ImageSharp . Web . Commands ;
1513using SixLabors . ImageSharp . Web . Middleware ;
1614using SixLabors . ImageSharp . Web . Processors ;
@@ -90,7 +88,7 @@ public ImageTagHelper(
9088 /// Passed through to the generated HTML in all cases.
9189 /// </remarks>
9290 [ HtmlAttributeName ( SrcAttributeName ) ]
93- public string Src { get ; set ; }
91+ public string ? Src { get ; set ; }
9492
9593 /// <summary>
9694 /// Gets or sets the width in pixel units.
@@ -198,7 +196,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
198196 Guard . NotNull ( context , nameof ( context ) ) ;
199197 Guard . NotNull ( output , nameof ( output ) ) ;
200198
201- string src = output . Attributes [ SrcAttributeName ] ? . Value as string ?? this . Src ;
199+ string ? src = output . Attributes [ SrcAttributeName ] ? . Value as string ?? this . Src ;
202200 if ( string . IsNullOrWhiteSpace ( src ) || src . StartsWith ( "data" , StringComparison . OrdinalIgnoreCase ) )
203201 {
204202 base . Process ( context , output ) ;
@@ -220,7 +218,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
220218 src = output . Attributes [ SrcAttributeName ] . Value as string ;
221219 if ( secret ? . Length > 0 )
222220 {
223- string hash = this . authorizationUtilities . ComputeHMAC ( src , commands , secret ) ;
221+ string hash = this . authorizationUtilities . ComputeHMAC ( src ! , commands , secret ) ;
224222 commands . Add ( RequestAuthorizationUtilities . TokenCommand , hash ) ;
225223 }
226224
@@ -256,7 +254,7 @@ private void AddResizeCommands(TagHelperOutput output, CommandCollection command
256254 // If no explicit width/height has been set on the image, set the attributes to match the
257255 // width/height from the process commands if present.
258256 int ? width = output . Attributes . ContainsName ( ResizeWebProcessor . Width )
259- ? int . Parse ( output . Attributes [ ResizeWebProcessor . Width ] . Value . ToString ( ) , this . parserCulture )
257+ ? int . Parse ( output . Attributes [ ResizeWebProcessor . Width ] . Value . ToString ( ) ! , this . parserCulture )
260258 : null ;
261259
262260 if ( this . Width . HasValue )
@@ -266,7 +264,7 @@ private void AddResizeCommands(TagHelperOutput output, CommandCollection command
266264 }
267265
268266 int ? height = output . Attributes . ContainsName ( ResizeWebProcessor . Height )
269- ? int . Parse ( output . Attributes [ ResizeWebProcessor . Height ] . Value . ToString ( ) , this . parserCulture )
267+ ? int . Parse ( output . Attributes [ ResizeWebProcessor . Height ] . Value . ToString ( ) ! , this . parserCulture )
270268 : null ;
271269
272270 if ( this . Height . HasValue )
@@ -365,7 +363,7 @@ private static string AddQueryString(
365363 StringBuilder sb = new ( ) ;
366364 sb . Append ( uriToBeAppended ) ;
367365
368- foreach ( KeyValuePair < string , string > parameter in commands )
366+ foreach ( KeyValuePair < string , string ? > parameter in commands )
369367 {
370368 if ( parameter . Value is null )
371369 {
0 commit comments