parsePathPresets parses presets from the URL path
( ctx context.Context, parts []string, features *clientfeatures.Features, )
| 256 | |
| 257 | // parsePathPresets parses presets from the URL path |
| 258 | func (p *Parser) parsePathPresets( |
| 259 | ctx context.Context, |
| 260 | parts []string, |
| 261 | features *clientfeatures.Features, |
| 262 | ) (*options.Options, string, error) { |
| 263 | o, err := p.defaultProcessingOptions(ctx, features) |
| 264 | if err != nil { |
| 265 | return nil, "", err |
| 266 | } |
| 267 | |
| 268 | presets := strings.Split(parts[0], p.config.ArgumentsSeparator) |
| 269 | urlParts := parts[1:] |
| 270 | |
| 271 | if err = p.applyPresetOption(ctx, o, presets); err != nil { |
| 272 | return nil, "", err |
| 273 | } |
| 274 | |
| 275 | url, extension, err := p.DecodeURL(ctx, urlParts) |
| 276 | if err != nil { |
| 277 | return nil, "", err |
| 278 | } |
| 279 | |
| 280 | if !options.Get(o, keys.Raw, false) && len(extension) > 0 { |
| 281 | if err = p.applyFormatOption(ctx, o, []string{extension}); err != nil { |
| 282 | return nil, "", err |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | return o, url, nil |
| 287 | } |
no test coverage detected