Skip to content

Commit

Permalink
Fix error format code (#17146)
Browse files Browse the repository at this point in the history
* update ImageSharpMiddlewareOption for fixing invalid width and height (#17126)

Co-authored-by: Lan Nguyen Thuy <[email protected]>

* Fix issue format parameters

---------

Co-authored-by: Lan Nguyen Thuy <[email protected]>

(cherry picked from commit 9a12eea)
  • Loading branch information
NguyenThuyLan authored and bergmania committed Sep 27, 2024
1 parent 762d72b commit 4660490
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ public void Configure(ImageSharpMiddlewareOptions options)

if (context.Commands.Contains(ResizeWebProcessor.Width))
{
if (!int.TryParse(context.Commands.GetValueOrDefault(ResizeWebProcessor.Width), NumberStyles.Integer,
CultureInfo.InvariantCulture, out var width)
if (!int.TryParse(
context.Commands.GetValueOrDefault(ResizeWebProcessor.Width),
NumberStyles.Integer,
CultureInfo.InvariantCulture,
out var width)
|| width < 0
|| width >= _imagingSettings.Resize.MaxWidth)
{
Expand All @@ -62,8 +65,11 @@ public void Configure(ImageSharpMiddlewareOptions options)

if (context.Commands.Contains(ResizeWebProcessor.Height))
{
if (!int.TryParse(context.Commands.GetValueOrDefault(ResizeWebProcessor.Height), NumberStyles.Integer,
CultureInfo.InvariantCulture, out var height)
if (!int.TryParse(
context.Commands.GetValueOrDefault(ResizeWebProcessor.Height),
NumberStyles.Integer,
CultureInfo.InvariantCulture,
out var height)
|| height < 0
|| height >= _imagingSettings.Resize.MaxHeight)
{
Expand Down

0 comments on commit 4660490

Please sign in to comment.