parseBase64String parses a base64-encoded string option value
( ctx context.Context, o *options.Options, key string, args ...string, )
| 244 | |
| 245 | // parseBase64String parses a base64-encoded string option value |
| 246 | func (p *Parser) parseBase64String( |
| 247 | ctx context.Context, |
| 248 | o *options.Options, |
| 249 | key string, |
| 250 | args ...string, |
| 251 | ) error { |
| 252 | if err := p.ensureMaxArgs(ctx, key, args, 1); err != nil { |
| 253 | return err |
| 254 | } |
| 255 | |
| 256 | b, err := base64.RawURLEncoding.DecodeString(strings.TrimRight(args[0], "=")) |
| 257 | if err != nil { |
| 258 | return newInvalidArgumentError(ctx, key, args[0], "URL-safe base64-encoded string") |
| 259 | } |
| 260 | |
| 261 | o.Set(key, string(b)) |
| 262 | |
| 263 | return nil |
| 264 | } |
| 265 | |
| 266 | // parseHexRGBColor parses a hex-encoded RGB color option value |
| 267 | func (p *Parser) parseHexRGBColor( |
no test coverage detected