Skip to content

Update ImageSharpMiddlewareOption for fixing invalid width and height#17126

Merged
bergmania merged 1 commit intov13/devfrom
update-image-sharp-middleware-option
Sep 25, 2024
Merged

Update ImageSharpMiddlewareOption for fixing invalid width and height#17126
bergmania merged 1 commit intov13/devfrom
update-image-sharp-middleware-option

Conversation

@NguyenThuyLan
Copy link
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes

Description

There is an issue when passing an invalid value in the width or height parameter, it could get a FormatException thrown.
Example: domain.com/media/jk4feiat/image.png?width=foo&height=150
OR
domain.com/media/jk4feiat/image.png?width=200&height=bar
OR
domain.com/media/jk4feiat/image.png?width=foo&height=bar

Solution: Check width and height in ConfigureImageSharpMiddlewareOptions and parse it with invariant culture into an integer.

@bergmania bergmania merged commit 9b19d63 into v13/dev Sep 25, 2024
@bergmania bergmania deleted the update-image-sharp-middleware-option branch September 25, 2024 11:19
NguyenThuyLan added a commit that referenced this pull request Sep 27, 2024
bergmania pushed a commit that referenced this pull request Sep 27, 2024
* update ImageSharpMiddlewareOption for fixing invalid width and height (#17126)

Co-authored-by: Lan Nguyen Thuy <lnt@umbraco.dk>

* Fix issue format parameters

---------

Co-authored-by: Lan Nguyen Thuy <lnt@umbraco.dk>
bergmania pushed a commit that referenced this pull request Sep 27, 2024
…#17126)

Co-authored-by: Lan Nguyen Thuy <lnt@umbraco.dk>
(cherry picked from commit 9b19d63)
bergmania pushed a commit that referenced this pull request Sep 27, 2024
* update ImageSharpMiddlewareOption for fixing invalid width and height (#17126)

Co-authored-by: Lan Nguyen Thuy <lnt@umbraco.dk>

* Fix issue format parameters

---------

Co-authored-by: Lan Nguyen Thuy <lnt@umbraco.dk>

(cherry picked from commit 9a12eea)
@TheFogOfWar1
Copy link

@NguyenThuyLan Thanks for fixing the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants