MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / applyFormatOption

Method applyFormatOption

options/parser/apply.go:383–395  ·  view source on GitHub ↗
(ctx context.Context, o *options.Options, args []string)

Source from the content-addressed store, hash-verified

381}
382
383func (p *Parser) applyFormatOption(ctx context.Context, o *options.Options, args []string) error {
384 if err := p.ensureMaxArgs(ctx, keys.Format, args, 1); err != nil {
385 return err
386 }
387
388 if f, ok := imagetype.GetTypeByName(args[0]); ok {
389 o.Set(keys.Format, f)
390 } else {
391 return newInvalidArgumentError(ctx, keys.Format, args[0], "supported image format")
392 }
393
394 return nil
395}
396
397func (p *Parser) applyCacheBusterOption(ctx context.Context, o *options.Options, args []string) error {
398 if err := p.ensureMaxArgs(ctx, keys.CacheBuster, args, 1); err != nil {

Callers 3

applyURLOptionMethod · 0.95
parsePathOptionsMethod · 0.95
parsePathPresetsMethod · 0.95

Calls 4

ensureMaxArgsMethod · 0.95
GetTypeByNameFunction · 0.92
newInvalidArgumentErrorFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected