parsePathOptions parses processing options from the URL path
( ctx context.Context, parts []string, features *clientfeatures.Features, )
| 221 | |
| 222 | // parsePathOptions parses processing options from the URL path |
| 223 | func (p *Parser) parsePathOptions( |
| 224 | ctx context.Context, |
| 225 | parts []string, |
| 226 | features *clientfeatures.Features, |
| 227 | ) (*options.Options, string, error) { |
| 228 | if _, ok := processing.ResizeTypes[parts[0]]; ok { |
| 229 | return nil, "", newInvalidURLError(ctx, "It looks like you're using the deprecated basic URL format") |
| 230 | } |
| 231 | |
| 232 | o, err := p.defaultProcessingOptions(ctx, features) |
| 233 | if err != nil { |
| 234 | return nil, "", err |
| 235 | } |
| 236 | |
| 237 | urlOpts, urlParts := p.parseURLOptions(parts) |
| 238 | |
| 239 | if err = p.applyURLOptions(ctx, o, urlOpts, false); err != nil { |
| 240 | return nil, "", err |
| 241 | } |
| 242 | |
| 243 | url, extension, err := p.DecodeURL(ctx, urlParts) |
| 244 | if err != nil { |
| 245 | return nil, "", err |
| 246 | } |
| 247 | |
| 248 | if !options.Get(o, keys.Raw, false) && len(extension) > 0 { |
| 249 | if err = p.applyFormatOption(ctx, o, []string{extension}); err != nil { |
| 250 | return nil, "", err |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | return o, url, nil |
| 255 | } |
| 256 | |
| 257 | // parsePathPresets parses presets from the URL path |
| 258 | func (p *Parser) parsePathPresets( |
no test coverage detected