(ctx context.Context, o *options.Options, args []string)
| 448 | } |
| 449 | |
| 450 | func (p *Parser) applyExpiresOption(ctx context.Context, o *options.Options, args []string) error { |
| 451 | if err := p.ensureMaxArgs(ctx, keys.Expires, args, 1); err != nil { |
| 452 | return err |
| 453 | } |
| 454 | |
| 455 | timestamp, err := strconv.ParseInt(args[0], 10, 64) |
| 456 | if err != nil { |
| 457 | return newInvalidArgumentError(ctx, keys.Expires, args[0], "unix timestamp") |
| 458 | } |
| 459 | |
| 460 | if timestamp > 0 && timestamp < time.Now().Unix() { |
| 461 | return newOptionArgumentError(ctx, keys.Expires, "Expired URL") |
| 462 | } |
| 463 | |
| 464 | o.Set(keys.Expires, time.Unix(timestamp, 0)) |
| 465 | |
| 466 | return nil |
| 467 | } |
| 468 | |
| 469 | func (p *Parser) applyStripMetadataOption(ctx context.Context, o *options.Options, args []string) error { |
| 470 | return p.parseBool(ctx, o, keys.StripMetadata, args...) |
no test coverage detected