(c *cli.Context)
| 289 | } |
| 290 | |
| 291 | func validatePipeCommand(c *cli.Context) error { |
| 292 | if c.Args().Len() != 1 { |
| 293 | return fmt.Errorf("expected destination argument") |
| 294 | } |
| 295 | |
| 296 | dst := c.Args().Get(0) |
| 297 | |
| 298 | dsturl, err := url.New(dst, url.WithRaw(c.Bool("raw"))) |
| 299 | if err != nil { |
| 300 | return err |
| 301 | } |
| 302 | |
| 303 | if !dsturl.IsRemote() { |
| 304 | return fmt.Errorf("destination must be a bucket") |
| 305 | } |
| 306 | |
| 307 | if dsturl.IsBucket() || dsturl.IsPrefix() { |
| 308 | return fmt.Errorf("target %q must be an object", dsturl) |
| 309 | } |
| 310 | |
| 311 | // wildcard destination can not be used with pipe |
| 312 | if dsturl.IsWildcard() { |
| 313 | return fmt.Errorf("target %q can not contain glob characters", dst) |
| 314 | } |
| 315 | |
| 316 | return nil |
| 317 | } |
| 318 | |
| 319 | func guessContentTypeByExtension(dsturl *url.URL) string { |
| 320 | contentType := mime.TypeByExtension(filepath.Ext(dsturl.Absolute())) |
no test coverage detected