diff --git a/drive/import.go b/drive/import.go index 2ee5f1e1..0162aa34 100644 --- a/drive/import.go +++ b/drive/import.go @@ -11,15 +11,19 @@ import ( type ImportArgs struct { Out io.Writer + Mime string Progress io.Writer Path string Parents []string } func (self *Drive) Import(args ImportArgs) error { - fromMime := getMimeType(args.Path) + fromMime := args.Mime if fromMime == "" { - return fmt.Errorf("Could not determine mime type of file") + fromMime = getMimeType(args.Path) + } + if fromMime == "" { + return fmt.Errorf("Could not determine mime type of file, use --mime") } about, err := self.service.About.Get().Fields("importFormats").Do() diff --git a/gdrive.go b/gdrive.go index ecb69503..90091927 100644 --- a/gdrive.go +++ b/gdrive.go @@ -719,6 +719,11 @@ func main() { Description: "Hide progress", OmitValue: true, }, + cli.StringFlag{ + Name: "mime", + Patterns: []string{"--mime"}, + Description: "Mime type of imported file", + }, ), }, }, diff --git a/handlers_drive.go b/handlers_drive.go index 8db7329b..c89b8c29 100644 --- a/handlers_drive.go +++ b/handlers_drive.go @@ -190,6 +190,7 @@ func infoHandler(ctx cli.Context) { func importHandler(ctx cli.Context) { args := ctx.Args() err := newDrive(args).Import(drive.ImportArgs{ + Mime: args.String("mime"), Out: os.Stdout, Path: args.String("path"), Parents: args.StringSlice("parent"),