Skip to content

How to prevent ImageSharp Web from resizing to certain sizes? #139

Answered by JimBobSquarePants
shapeh asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @shapeh

The place your are looking for is actually on that page. It's the options.OnParseCommandsAsync function.

We actually do some default sanitation to help reduce potential attack vectors (and disallow that specific evil user) but you can implement custom rules you want there instead. Here's the default method.

private Func<ImageCommandContext, Task> onParseCommandsAsync = c =>
{
if (c.Commands.Count == 0)
{
return Task.CompletedTask;
}
// It's a good idea to have this to provide very basic security.
// We can safely use the stati…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@JimBobSquarePants
Comment options

@shapeh
Comment options

@JimBobSquarePants
Comment options

@shapeh
Comment options

@eslam82badawy
Comment options

Answer selected by JimBobSquarePants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants