Update ImageSharpMiddlewareOption for fixing invalid width and height#17126
Merged
Update ImageSharpMiddlewareOption for fixing invalid width and height#17126
Conversation
bergmania
approved these changes
Sep 25, 2024
NguyenThuyLan
added a commit
that referenced
this pull request
Sep 27, 2024
…#17126) Co-authored-by: Lan Nguyen Thuy <lnt@umbraco.dk>
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
|
@NguyenThuyLan Thanks for fixing the issue! |
This was referenced Sep 28, 2025
This was referenced Oct 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
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.